diff options
Diffstat (limited to 'rpm2cpio.c')
-rw-r--r-- | rpm2cpio.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/rpm2cpio.c b/rpm2cpio.c index 89ebdfac0..8bee3c7cc 100644 --- a/rpm2cpio.c +++ b/rpm2cpio.c @@ -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(); |