From 7cdaa87e0f96ebd169020a531196e580342b8d80 Mon Sep 17 00:00:00 2001 From: ewt Date: Wed, 12 Feb 1997 04:48:51 +0000 Subject: [PATCH] made verify work on URLs CVS patchset: 1403 CVS date: 1997/02/12 04:48:51 --- verify.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/verify.c b/verify.c index 2db2d5a..ab397a2 100644 --- a/verify.c +++ b/verify.c @@ -8,6 +8,7 @@ #include "install.h" #include "query.h" #include "rpmlib.h" +#include "url.h" #include "verify.h" static void verifyHeader(char * prefix, Header h, int verifyFlags); @@ -140,7 +141,9 @@ void doVerify(char * prefix, enum verifysources source, char ** argv, int isSource; rpmdb db; dbiIndexSet matches; + struct urlContext context; char * arg; + int isUrl; if (source == VERIFY_RPM && !(verifyFlags & VERIFY_DEPS)) { db = NULL; @@ -168,11 +171,22 @@ void doVerify(char * prefix, enum verifysources source, char ** argv, switch (source) { case VERIFY_RPM: - fd = open(arg, O_RDONLY); - if (fd < 0) { - fprintf(stderr, "open of %s failed: %s\n", arg, - strerror(errno)); + if (urlIsURL(arg)) { + isUrl = 1; + if ((fd = urlGetFd(arg, &context)) < 0) { + fprintf(stderr, "open of %s failed: %s\n", arg, + ftpStrerror(fd)); + } + } else if (!strcmp(arg, "-")) { + fd = 0; } else { + if ((fd = open(arg, O_RDONLY)) < 0) { + fprintf(stderr, "open of %s failed: %s\n", arg, + strerror(errno)); + } + } + + if (fd >= 0) { rc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL); close(fd); switch (rc) { -- 2.7.4