Remove fperms and dperms from rpmfi struct
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 5 Nov 2008 13:18:43 +0000 (15:18 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 5 Nov 2008 13:18:43 +0000 (15:18 +0200)
- only fsm internals need and just use straightforward defaults, move
  the defaults there...

lib/fsm.c
lib/rpmfi.c
lib/rpmfi_internal.h

index fb2b5df..d4cfdef 100644 (file)
--- 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. */
index 26159f7..ec27f55 100644 (file)
@@ -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));
index e12a2d3..2cb9d3b 100644 (file)
@@ -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. */