]> granicus.if.org Git - shadow/commitdiff
Suppress pwconv passwd- chmod failure message
authorDuncan Eastoe <deastoe@Brocade.com>
Mon, 9 Feb 2015 14:39:31 +0000 (14:39 +0000)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 17 Feb 2015 16:15:02 +0000 (10:15 -0600)
Prevent chmod failure message from displaying if the failure
was due to the backup file not existing.

If there is no backup file present and if no changes have been
made, then this error would always appear since the backup
file isn't created in this situation.

Signed-off-by: Duncan Eastoe <deastoe@Brocade.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/pwconv.c

index 515eba194f0a59609d9de9290ac1a0837e1c1918..d41d5dd299aa6b6ac45f13a7c5c070547b081192 100644 (file)
@@ -305,7 +305,8 @@ int main (int argc, char **argv)
        }
 
        /* /etc/passwd- (backup file) */
-       if (chmod (PASSWD_FILE "-", 0600) != 0) {
+       errno = 0;
+       if ((chmod (PASSWD_FILE "-", 0600) != 0) && (errno != ENOENT)) {
                fprintf (stderr,
                         _("%s: failed to change the mode of %s to 0600\n"),
                         Prog, PASSWD_FILE "-");