1) don't ever change the umask
authorewt <devnull@localhost>
Wed, 12 Feb 1997 05:05:13 +0000 (05:05 +0000)
committerewt <devnull@localhost>
Wed, 12 Feb 1997 05:05:13 +0000 (05:05 +0000)
2) when installing sources with --root, directory checks need to
   use the relocated paths

CVS patchset: 1406
CVS date: 1997/02/12 05:05:13

lib/install.c

index 233f84d..08a085a 100644 (file)
@@ -173,8 +173,6 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd, char * location,
        return rc;
     }
 
-    umask(0);          /* we know what we're doing */
-
     /* Do this now so we can give error messages, even though we'll just
        do it again after relocating everything */
     headerGetEntry(h, RPMTAG_NAME, &type, (void **) &name, &fileCount);
@@ -232,11 +230,6 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd, char * location,
        return 2;
     }
 
-    if (labelFormat) {
-       printf(labelFormat, name, version, release);
-       fflush(stdout);
-    }
-
     rpmMessage(RPMMESS_DEBUG, "package: %s-%s-%s files test = %d\n", 
                name, version, release, flags & RPMINSTALL_TEST);
 
@@ -495,6 +488,11 @@ int rpmInstallPackage(char * rootdir, rpmdb db, int fd, char * location,
            return 2;
        }
 
+       if (labelFormat) {
+           printf(labelFormat, name, version, release);
+           fflush(stdout);
+       }
+
        /* the file pointer for fd is pointing at the cpio archive */
        if (installArchive(archivePrefix, fd, files, archiveFileCount, notify, 
                           NULL, tmpPath, 
@@ -1380,16 +1378,6 @@ static int installSources(Header h, char * rootdir, int fd,
     sourceDir = rpmGetVar(RPMVAR_SOURCEDIR);
     specDir = rpmGetVar(RPMVAR_SPECDIR);
 
-    if (access(sourceDir, W_OK)) {
-       rpmError(RPMERR_CREATE, "cannot write to %s", sourceDir);
-       return 2;
-    }
-
-    if (access(specDir, W_OK)) {
-       rpmError(RPMERR_CREATE, "cannot write to %s", specDir);
-       return 2;
-    }
-
     realSourceDir = alloca(strlen(rootdir) + strlen(sourceDir) + 2);
     strcpy(realSourceDir, rootdir);
     strcat(realSourceDir, "/");
@@ -1400,6 +1388,16 @@ static int installSources(Header h, char * rootdir, int fd,
     strcat(realSpecDir, "/");
     strcat(realSpecDir, specDir);
 
+    if (access(realSourceDir, W_OK)) {
+       rpmError(RPMERR_CREATE, "cannot write to %s", realSourceDir);
+       return 2;
+    }
+
+    if (access(realSpecDir, W_OK)) {
+       rpmError(RPMERR_CREATE, "cannot write to %s", realSpecDir);
+       return 2;
+    }
+
     rpmMessage(RPMMESS_DEBUG, "sources in: %s\n", realSourceDir);
     rpmMessage(RPMMESS_DEBUG, "spec file in: %s\n", realSpecDir);