Add macro %isu_package to generate ISU Package
[platform/upstream/rpm.git] / rpm2cpio.c
index 89ebdfa..8bee3c7 100644 (file)
@@ -1,7 +1,6 @@
 /* rpmarchive: spit out the main archive portion of a package */
 
 #include "system.h"
-const char *__progname;
 
 #include <rpm/rpmlib.h>                /* rpmReadPackageFile .. */
 #include <rpm/rpmtag.h>
@@ -9,6 +8,7 @@ const char *__progname;
 #include <rpm/rpmpgp.h>
 
 #include <rpm/rpmts.h>
+#include <unistd.h>
 
 #include "debug.h"
 
@@ -21,7 +21,8 @@ int main(int argc, char *argv[])
     off_t payload_size;
     FD_t gzdi;
     
-    setprogname(argv[0]);      /* Retrofit glibc __progname */
+    xsetprogname(argv[0]); /* Portability call -- see system.h */
+
     rpmReadConfigFiles(NULL, NULL);
     if (argc == 1)
        fdi = fdDup(STDIN_FILENO);
@@ -38,6 +39,10 @@ int main(int argc, char *argv[])
                (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi));
        exit(EXIT_FAILURE);
     }
+    if (isatty(STDOUT_FILENO)) {
+       fprintf(stderr, "Error: refusing to output cpio data to a terminal.\n");
+       exit(EXIT_FAILURE);
+    }
     fdo = fdDup(STDOUT_FILENO);
 
     {  rpmts ts = rpmtsCreate();