Issue an error on failure to replace original package on signing
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 25 May 2011 07:20:45 +0000 (10:20 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 25 May 2011 07:20:45 +0000 (10:20 +0300)
- Previously any failure on replacing the original package with the
  newly signed one would silently fail, causing rather confusing
  behavior when eg attempting to (re)sign readable but not writable
  packages.

sign/rpmgensig.c

index e858e21..1aa15f6 100644 (file)
@@ -571,8 +571,12 @@ static int rpmSign(const char *rpm, int deleting, const char *passPhrase)
 
        /* Move final target into place, restore file permissions. */
        if (stat(rpm, &st) == 0 && unlink(rpm) == 0 &&
-                   rename(trpm, rpm) == 0 && chmod(rpm, st.st_mode) == 0)
+                   rename(trpm, rpm) == 0 && chmod(rpm, st.st_mode) == 0) {
            res = 0;
+       } else {
+           rpmlog(RPMLOG_ERR, _("replacing %s failed: %s\n"),
+                  rpm, strerror(errno));
+       }
     }
 
 exit: