1) display more intelligent errors when ftp queries fail
authorewt <devnull@localhost>
Sun, 20 Oct 1996 18:24:18 +0000 (18:24 +0000)
committerewt <devnull@localhost>
Sun, 20 Oct 1996 18:24:18 +0000 (18:24 +0000)
2

CVS patchset: 1106
CVS date: 1996/10/20 18:24:18

query.c

diff --git a/query.c b/query.c
index 181784a..a816d57 100644 (file)
--- a/query.c
+++ b/query.c
@@ -639,15 +639,19 @@ int doQuery(char * prefix, enum querysources source, int queryFlags,
       case QUERY_RPM:
        if (urlIsURL(arg)) {
            isUrl = 1;
-           fd = urlGetFd(arg, &context);
+           if ((fd = urlGetFd(arg, &context)) < 0) {
+               fprintf(stderr, "open of %s failed: %s\n", arg, 
+                       ftpStrerror(fd));
+           }
        } else {
            isUrl = 0;
-           fd = open(arg, O_RDONLY);
+           if ((fd = open(arg, O_RDONLY)) < 0) {
+               fprintf(stderr, "open of %s failed: %s\n", arg, 
+                       strerror(errno));
+           }
        }
 
-       if (fd < 0) {
-           fprintf(stderr, "open of %s failed: %s\n", arg, strerror(errno));
-       } else {
+       if (fd >= 0) {
            rc = pkgReadHeader(fd, &h, &isSource, NULL, NULL);
 
            close(fd);