Restore CWD after packing files
authormarc <devnull@localhost>
Wed, 30 Jul 1997 22:19:39 +0000 (22:19 +0000)
committermarc <devnull@localhost>
Wed, 30 Jul 1997 22:19:39 +0000 (22:19 +0000)
CVS patchset: 1777
CVS date: 1997/07/30 22:19:39

build/pack.c

index cdb24b3..dafd446 100644 (file)
@@ -193,6 +193,7 @@ static int cpio_gzip(int fd, char *tempdir, char *writePtr,
     struct cpioFileMapping * cpioList;
     int status;
     void *oldhandler;
+    char savecwd[1024];
 
     gzipbin = rpmGetVar(RPMVAR_GZIPBIN);
 
@@ -239,6 +240,8 @@ static int cpio_gzip(int fd, char *tempdir, char *writePtr,
 
     close(toGzip[0]);
 
+    getcwd(savecwd, 1024);
+    
     if (tempdir) {
        chdir(tempdir);
     } else if (rpmGetVar(RPMVAR_ROOT)) {
@@ -258,6 +261,8 @@ static int cpio_gzip(int fd, char *tempdir, char *writePtr,
        }
     }
 
+    chdir(savecwd);
+
     rc = cpioBuildArchive(toGzip[1], cpioList, numMappings, NULL, NULL, NULL);
 
     close(toGzip[1]); /* Terminates the gzip process */