--- /dev/null
+--- rpm-5.4.15/rpmio/iosm.c~ 2014-06-11 19:58:04.000000000 +0200
++++ rpm-5.4.15/rpmio/iosm.c 2015-01-25 21:53:27.659197235 +0100
+@@ -2627,7 +2627,7 @@
+ iosm->rfd = NULL;
+ break;
+ case IOSM_WOPEN:
+- iosm->wfd = Fopen(iosm->path, "w.fdio");
++ iosm->wfd = Fopen(iosm->path, "wU.fdio");
+ if (iosm->wfd == NULL || Ferror(iosm->wfd)) {
+ if (iosm->wfd != NULL) (void) iosmNext(iosm, IOSM_WCLOSE);
+ iosm->wfd = NULL;
+--- rpm-5.4.15/rpmio/rpmio.c~ 2014-08-05 00:47:16.000000000 +0200
++++ rpm-5.4.15/rpmio/rpmio.c 2015-01-25 21:50:59.409202466 +0100
+@@ -2638,16 +2638,20 @@
+ * - bzopen: 'q' sets verbosity to 0
+ * - bzopen: 'v' does verbosity++ (up to 4)
+ * - HACK: '.' terminates, rest is type of I/O
++ * - 'U' sets *mode to zero (no permissions) instead of 0666
+ */
+ static inline void cvtfmode (const char *m,
+ /*@out@*/ char *stdio, size_t nstdio,
+ /*@out@*/ char *other, size_t nother,
+- /*@out@*/ const char **end, /*@out@*/ int * f)
++ /*@out@*/ const char **end, /*@out@*/ int * f, mode_t *mode)
+ /*@modifies *stdio, *other, *end, *f @*/
+ {
+ int flags = 0;
+ char c;
+
++ if (mode)
++ *mode = 0666;
++
+ switch (*m) {
+ case 'a':
+ flags |= O_WRONLY | O_CREAT | O_APPEND;
+@@ -2661,6 +2665,9 @@
+ flags |= O_RDONLY;
+ if (--nstdio > 0) *stdio++ = *m;
+ break;
++ case 'U':
++ if (mode) *mode = 0;
++ break;
+ default:
+ *stdio = '\0';
+ return;
+@@ -2729,7 +2736,7 @@
+ if (fmode == NULL)
+ return NULL;
+
+- cvtfmode(fmode, stdio, sizeof(stdio), other, sizeof(other), &end, NULL);
++ cvtfmode(fmode, stdio, sizeof(stdio), other, sizeof(other), &end, NULL, NULL);
+ if (stdio[0] == '\0')
+ return NULL;
+ zstdio[0] = '\0';
+@@ -2835,7 +2842,7 @@
+ const char * fmode = NULL;
+ char stdio[20], other[20];
+ const char *end = NULL;
+- mode_t perms = 0666;
++ mode_t perms;
+ int flags = 0;
+ FD_t fd = NULL;
+
+@@ -2849,7 +2856,7 @@
+ fprintf(stderr, "==> Fopen(%s, %s)\n", path, fmode);
+
+ stdio[0] = '\0';
+- cvtfmode(fmode, stdio, sizeof(stdio), other, sizeof(other), &end, &flags);
++ cvtfmode(fmode, stdio, sizeof(stdio), other, sizeof(other), &end, &flags, &perms);
+ if (stdio[0] == '\0')
+ goto exit;
+