RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [email protected] Module: rpm Date: 12-Oct-2009 03:34:42 Branch: HEAD Handle: 2009101201344200 Modified files: rpm/lib fsm.c rpm/rpmdb rpmdb.h Log: - dbi: handle Lsetfilecon(3) logging which can have missing data. Summary: Revision Changes Path 2.190 +5 -1 rpm/lib/fsm.c 1.115 +2 -1 rpm/rpmdb/rpmdb.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/lib/fsm.c ============================================================================ $ cvs diff -u -r2.189 -r2.190 fsm.c --- rpm/lib/fsm.c 10 Oct 2009 23:37:04 -0000 2.189 +++ rpm/lib/fsm.c 12 Oct 2009 01:34:42 -0000 2.190 @@ -2281,7 +2281,11 @@ rc = rpmlioRmdir(rpmtsGetRdb(fsmGetTs(fsm)), fsm->path, st->st_mode); goto iosmcall; case IOSM_LSETFCON: - rc = rpmlioLsetfilecon(rpmtsGetRdb(fsmGetTs(fsm)), fsm->path, fsm->fcontext); + /* Log iff lsetfilecon() will actually be called. */ + if (iosm->fcontext && *iosm->fcontext + && strcmp(iosm->fcontext, "<<none>>")) + rc = rpmlioLsetfilecon(rpmtsGetRdb(fsmGetTs(fsm)), + fsm->path, fsm->fcontext); goto iosmcall; case IOSM_CHOWN: rc = rpmlioChown(rpmtsGetRdb(fsmGetTs(fsm)), fsm->path, st->st_uid, st->st_gid); @@ . patch -p0 <<'@@ .' Index: rpm/rpmdb/rpmdb.h ============================================================================ $ cvs diff -u -r1.114 -r1.115 rpmdb.h --- rpm/rpmdb/rpmdb.h 10 Oct 2009 23:37:04 -0000 1.114 +++ rpm/rpmdb/rpmdb.h 12 Oct 2009 01:34:42 -0000 1.115 @@ -1251,10 +1251,11 @@ DBT CONTEXTdbt = {0}; FNdbt.data = (void *)fn; FNdbt.size = strlen(fn) + 1; /* trailing NUL too */ + if (context == NULL) context = ""; /* XXX prevent segfaults */ CONTEXTdbt.data = (void *)context; CONTEXTdbt.size = strlen(context) + 1; /* trailing NUL too */ rc = logio_Lsetfilecon_log(dbenv, _txn, &_lsn, DB_FLUSH, &FNdbt, &CONTEXTdbt); -fprintf(stderr, "<== %s(%s, %s) rc %d\n", __FUNCTION__, fn, context, rc); +fprintf(stderr, "<== %s(%s, \"%s\") rc %d\n", __FUNCTION__, fn, context, rc); return rc; } @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
