teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

Blame SOURCES/rpm-4.11.x-chmod.patch

5523e9
--- rpm-4.11.1/lib/fsm.c.orig	2014-11-13 13:38:56.742934031 +0100
5523e9
+++ rpm-4.11.1/lib/fsm.c	2014-11-13 13:42:13.036380024 +0100
5523e9
@@ -726,12 +726,17 @@
5523e9
 {
5523e9
     FD_t wfd = NULL;
5523e9
     const struct stat * st = &fsm->sb;
5523e9
-    rpm_loff_t left = st->st_size;
5523e9
+    rpm_loff_t left = rpmfiFSizeIndex(fsmGetFi(fsm), fsm->ix);
5523e9
     const unsigned char * fidigest = NULL;
5523e9
     pgpHashAlgo digestalgo = 0;
5523e9
     int rc = 0;
5523e9
 
5523e9
-    wfd = Fopen(fsm->path, "w.ufdio");
5523e9
+    /* Create the file with 000 permissions. */
5523e9
+    {
5523e9
+	mode_t old_umask = umask(0777);
5523e9
+	wfd = Fopen(fsm->path, "w.ufdio");
5523e9
+	umask(old_umask);
5523e9
+    }                      
5523e9
     if (Ferror(wfd)) {
5523e9
 	rc = CPIOERR_OPEN_FAILED;
5523e9
 	goto exit;