From: Duncan Eastoe Date: Mon, 9 Feb 2015 14:39:31 +0000 (+0000) Subject: Suppress pwconv passwd- chmod failure message X-Git-Tag: 4.3.0~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=17887b216d6d8292870c572ce4be950cc4077f2a;p=shadow Suppress pwconv passwd- chmod failure message 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 Signed-off-by: Serge Hallyn --- diff --git a/src/pwconv.c b/src/pwconv.c index 515eba19..d41d5dd2 100644 --- a/src/pwconv.c +++ b/src/pwconv.c @@ -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 "-");