make sure files to sign exist before asking for the pass phrase
authorewt <devnull@localhost>
Wed, 30 Dec 1998 20:22:18 +0000 (20:22 +0000)
committerewt <devnull@localhost>
Wed, 30 Dec 1998 20:22:18 +0000 (20:22 +0000)
CVS patchset: 2625
CVS date: 1998/12/30 20:22:18

CHANGES
rpm.c

diff --git a/CHANGES b/CHANGES
index 720629c..112f0e8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -36,6 +36,7 @@
        - add {init,add,expand}Macro args everywhere (new macro.c compatibility)
        - add new fully recursive macro.c
        - there must be a { between two % in a query format (unless %% is used)
+       - make sure files to sign exist before asking for the pass phrase
 
 2.5.5 -> 2.5.6:
        - ultrapenguin 1.1.9 sparc64 changes.
diff --git a/rpm.c b/rpm.c
index 1e50348..228e882 100755 (executable)
--- a/rpm.c
+++ b/rpm.c
@@ -1042,10 +1042,26 @@ int main(int argc, char ** argv) {
     if (signIt) {
         if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD ||
            bigMode == MODE_RESIGN || bigMode == MODE_TARBUILD) {
+           char ** argv;
+           struct stat sb;
+           int errors = 0;
+
+           argv = poptGetArgs(optCon);
+           while (*argv) {
+               if (stat(*argv, &sb)) {
+                   fprintf(stderr, _("cannot access file %s\n"), *argv);
+                   errors++;
+               }
+               argv++;
+           }
+
+           if (errors) return errors;
+
             if (poptPeekArg(optCon)) {
                switch (rpmLookupSignatureType()) {
                  case RPMSIGTAG_PGP:
-                   if (!(passPhrase = rpmGetPassPhrase("Enter pass phrase: "))) {
+                   if (!(passPhrase = 
+                               rpmGetPassPhrase("Enter pass phrase: "))) {
                        fprintf(stderr, _("Pass phrase check failed\n"));
                        exit(EXIT_FAILURE);
                    } else {