/* 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>
#include <rpm/rpmpgp.h>
#include <rpm/rpmts.h>
+#include <unistd.h>
#include "debug.h"
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);
(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();