summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-11-30 14:49:45 +0000
committerjbj <devnull@localhost>1999-11-30 14:49:45 +0000
commit4e56943831a57ab9cc00182007ee55c6fc46ba1e (patch)
tree7329be2ea7201345172038ca61592bfcf912f86a /tools
parentc48ddf778309aae045945c372cc2eae9e60fcaa9 (diff)
downloadrpm-4e56943831a57ab9cc00182007ee55c6fc46ba1e.tar.gz
rpm-4e56943831a57ab9cc00182007ee55c6fc46ba1e.tar.bz2
rpm-4e56943831a57ab9cc00182007ee55c6fc46ba1e.zip
lib/install.c: Check errno and mkdir specdir/sourcedir only for local fs.
lib/rpmio.c: Create ftpOpen/httpOpen from ufdOpen case's. lib/rpmio.c: ftpStat et al uses ftpOpen and NLST w/o path. lib/query.c: Don't Fclose(fd) if fd == NULL. CVS patchset: 3442 CVS date: 1999/11/30 14:49:45
Diffstat (limited to 'tools')
-rw-r--r--tools/dump.c4
-rw-r--r--tools/rpmarchive.c8
-rw-r--r--tools/rpmheader.c13
-rw-r--r--tools/rpmlead.c12
-rw-r--r--tools/rpmsignature.c12
5 files changed, 27 insertions, 22 deletions
diff --git a/tools/dump.c b/tools/dump.c
index 50122080d..d3e866b35 100644
--- a/tools/dump.c
+++ b/tools/dump.c
@@ -9,12 +9,12 @@ int main(int argc, char ** argv)
setprogname(argv[0]); /* Retrofit glibc __progname */
if (argc == 1) {
- fdi = fdDup(STDIN_FILENO);
+ fdi = Fopen("-", "r.ufdio");
} else {
fdi = Fopen(argv[1], "r.ufdio");
}
- if (Ferror(fdi)) {
+ if (fdi == NULL || Ferror(fdi)) {
fprintf(stderr, _("cannot open %s: %s\n"), argv[1], strerror(errno));
exit(EXIT_FAILURE);
}
diff --git a/tools/rpmarchive.c b/tools/rpmarchive.c
index 21856ccab..e599b488f 100644
--- a/tools/rpmarchive.c
+++ b/tools/rpmarchive.c
@@ -16,17 +16,21 @@ int main(int argc, char **argv)
setprogname(argv[0]); /* Retrofit glibc __progname */
if (argc == 1) {
- fdi = fdDup(STDIN_FILENO);
+ fdi = Fopen("-", "r.ufdio");
} else {
fdi = Fopen(argv[1], "r.ufdio");
}
+ if (fdi == NULL || Ferror(fdi)) {
+ perror("input");
+ exit(EXIT_FAILURE);
+ }
readLead(fdi, &lead);
rpmReadSignature(fdi, NULL, lead.signature_type);
hd = headerRead(fdi, (lead.major >= 3) ?
HEADER_MAGIC_YES : HEADER_MAGIC_NO);
- fdo = fdDup(STDOUT_FILENO);
+ fdo = Fopen("-", "w.ufdio");
while ((ct = Fread(buffer, sizeof(buffer), 1, fdi))) {
Fwrite(buffer, ct, 1, fdo);
}
diff --git a/tools/rpmheader.c b/tools/rpmheader.c
index 12aacdee2..39bf01a29 100644
--- a/tools/rpmheader.c
+++ b/tools/rpmheader.c
@@ -15,20 +15,21 @@ int main(int argc, char **argv)
setprogname(argv[0]); /* Retrofit glibc __progname */
if (argc == 1) {
- fdi = fdDup(STDIN_FILENO);
+ fdi = Fopen("-", "r.ufdio");
} else {
fdi = Fopen(argv[1], "r.ufdio");
- if (Ferror(fdi)) {
- perror(argv[1]);
- exit(EXIT_FAILURE);
- }
+ }
+
+ if (fdi == NULL || Ferror(fdi)) {
+ perror("input");
+ exit(EXIT_FAILURE);
}
readLead(fdi, &lead);
rpmReadSignature(fdi, NULL, lead.signature_type);
hd = headerRead(fdi, (lead.major >= 3) ?
HEADER_MAGIC_YES : HEADER_MAGIC_NO);
- fdo = fdDup(STDOUT_FILENO);
+ fdo = Fopen("-", "w.ufdio");
rc = headerWrite(fdo, hd, HEADER_MAGIC_YES);
return rc;
diff --git a/tools/rpmlead.c b/tools/rpmlead.c
index 7b2a88d3f..4770ea182 100644
--- a/tools/rpmlead.c
+++ b/tools/rpmlead.c
@@ -12,17 +12,17 @@ int main(int argc, char **argv)
setprogname(argv[0]); /* Retrofit glibc __progname */
if (argc == 1) {
- fdi = fdDup(STDIN_FILENO);
+ fdi = Fopen("-", "r.ufdio");
} else {
fdi = Fopen(argv[1], "r.ufdio");
- if (Ferror(fdi)) {
- perror(argv[1]);
- exit(EXIT_FAILURE);
- }
+ }
+ if (fdi == NULL || Ferror(fdi)) {
+ perror(argv[1]);
+ exit(EXIT_FAILURE);
}
readLead(fdi, &lead);
- fdo = fdDup(STDOUT_FILENO);
+ fdo = Fopen("-", "w.ufdio");
writeLead(fdo, &lead);
return 0;
diff --git a/tools/rpmsignature.c b/tools/rpmsignature.c
index 50d685093..0723dff4c 100644
--- a/tools/rpmsignature.c
+++ b/tools/rpmsignature.c
@@ -13,13 +13,13 @@ int main(int argc, char **argv)
setprogname(argv[0]); /* Retrofit glibc __progname */
if (argc == 1) {
- fdi = fdDup(STDIN_FILENO);
+ fdi = Fopen("-", "r.ufdio");
} else {
fdi = Fopen(argv[1], "r.ufdio");
- if (Ferror(fdi)) {
- perror(argv[1]);
- exit(1);
- }
+ }
+ if (Ferror(fdi)) {
+ perror("input");
+ exit(1);
}
readLead(fdi, &lead);
@@ -29,7 +29,7 @@ int main(int argc, char **argv)
fprintf(stderr, _("No signature available.\n"));
break;
default:
- fdo = fdDup(STDOUT_FILENO);
+ fdo = Fopen("-", "w.ufdio");
rpmWriteSignature(fdo, sig);
}