From b43998c374abae3b689a3698a2006fdafac1146a Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 5 Nov 2008 15:18:43 +0200 Subject: Remove fperms and dperms from rpmfi struct - only fsm internals need and just use straightforward defaults, move the defaults there... --- lib/fsm.c | 9 ++++++--- lib/rpmfi.c | 3 --- lib/rpmfi_internal.h | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/fsm.c b/lib/fsm.c index fb2b5df39..d4cfdef7d 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -77,6 +77,10 @@ static rpmfi fsmGetFi(const FSM_t fsm) #define SUFFIX_RPMSAVE ".rpmsave" #define SUFFIX_RPMNEW ".rpmnew" +/* Default directory and file permissions if not mapped */ +#define _dirPerms 0755 +#define _filePerms 0644 + /* * XXX Forward declarations for previously exported functions to avoid moving * things around needlessly @@ -718,7 +722,7 @@ static int fsmMapAttrs(FSM_t fsm) int i = fsm->ix; if (fi && i >= 0 && i < fi->fc) { - mode_t perms = (S_ISDIR(st->st_mode) ? fi->dperms : fi->fperms); + mode_t perms = (S_ISDIR(st->st_mode) ? _dirPerms : _filePerms); mode_t finalMode = (fi->fmodes ? fi->fmodes[i] : perms); dev_t finalRdev = (fi->frdevs ? fi->frdevs[i] : 0); rpm_time_t finalMtime = (fi->fmtimes ? fi->fmtimes[i] : 0); @@ -1214,9 +1218,8 @@ static int fsmMkdirs(FSM_t fsm) /* Move pre-existing path marker forward. */ fsm->dnlx[dc] = (te - dn); } else if (rc == CPIOERR_ENOENT) { - rpmfi fi = fsmGetFi(fsm); *te = '\0'; - st->st_mode = S_IFDIR | (fi->dperms & 07777); + st->st_mode = S_IFDIR | (_dirPerms & 07777); rc = fsmNext(fsm, FSM_MKDIR); if (!rc) { /* XXX FIXME? only new dir will have context set. */ diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 26159f79e..ec27f5518 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -1359,9 +1359,6 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags) fi->fnlen = dnlmax + bnlmax + 1; fi->fn = NULL; - fi->dperms = 0755; - fi->fperms = 0644; - exit: if (_rpmfi_debug < 0) fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, Type, (fi ? fi->fc : 0)); diff --git a/lib/rpmfi_internal.h b/lib/rpmfi_internal.h index e12a2d3ca..2cb9d3bb5 100644 --- a/lib/rpmfi_internal.h +++ b/lib/rpmfi_internal.h @@ -105,8 +105,6 @@ struct rpmfi_s { size_t striplen; rpm_loff_t archivePos; rpm_loff_t archiveSize; - mode_t dperms; /*!< Directory perms (0755) if not mapped. */ - mode_t fperms; /*!< File perms (0644) if not mapped. */ const char ** apath; cpioMapFlags mapflags; FSM_t fsm; /*!< File state machine data. */ -- cgit v1.2.3