From: ewt Date: Sun, 20 Oct 1996 18:24:18 +0000 (+0000) Subject: 1) display more intelligent errors when ftp queries fail X-Git-Tag: tznext/4.11.0.1.tizen20130304~10854 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=37f861b22af3d8cda33acc95e43f4697e51951a9;p=tools%2Flibrpm-tizen.git 1) display more intelligent errors when ftp queries fail 2 CVS patchset: 1106 CVS date: 1996/10/20 18:24:18 --- diff --git a/query.c b/query.c index 181784a..a816d57 100644 --- 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);