summaryrefslogtreecommitdiff
path: root/src/pwconv.c
diff options
context:
space:
mode:
authorBalint Reczey <balint@balintreczey.hu>2016-11-30 02:36:06 +0100
committerBalint Reczey <balint@balintreczey.hu>2016-11-30 02:36:06 +0100
commit365658d0f3a51814626afbb70aa2dd7b5e82ac36 (patch)
tree7218fb9147359258fda0f9a43da5a29b2d20e85b /src/pwconv.c
parentbfaa59229d61adb7fa0c570f0d94fd324c6e05aa (diff)
downloadshadow-365658d0f3a51814626afbb70aa2dd7b5e82ac36.tar.gz
Imported Upstream version 4.4upstream/4.4
Diffstat (limited to 'src/pwconv.c')
-rw-r--r--src/pwconv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pwconv.c b/src/pwconv.c
index 515eba19..e2d61f87 100644
--- a/src/pwconv.c
+++ b/src/pwconv.c
@@ -200,7 +200,7 @@ int main (int argc, char **argv)
fail_exit (E_PWDBUSY);
}
pw_locked = true;
- if (pw_open (O_RDWR) == 0) {
+ if (pw_open (O_CREAT | O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"), Prog, pw_dbname ());
fail_exit (E_MISSING);
@@ -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 "-");