From: Serge Hallyn Date: Sun, 25 Mar 2018 01:29:48 +0000 (-0500) Subject: pwck.c: do not pass O_CREAT X-Git-Tag: 4.6~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d3790feac0b47bb817c572ac57e6bd4fc7f84b4a;p=thirdparty%2Fshadow.git pwck.c: do not pass O_CREAT It causes a crash later when we try to close files. Closes #96 Signed-off-by: Serge Hallyn --- diff --git a/src/pwck.c b/src/pwck.c index 523135f63..05df68ece 100644 --- a/src/pwck.c +++ b/src/pwck.c @@ -281,7 +281,7 @@ static void open_files (void) * Open the files. Use O_RDONLY if we are in read_only mode, O_RDWR * otherwise. */ - if (pw_open (read_only ? O_RDONLY : O_CREAT | O_RDWR) == 0) { + if (pw_open (read_only ? O_RDONLY : O_RDWR) == 0) { fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ()); if (use_system_pw_file) { @@ -290,7 +290,7 @@ static void open_files (void) fail_exit (E_CANTOPEN); } if (is_shadow && !use_tcb) { - if (spw_open (read_only ? O_RDONLY : O_CREAT | O_RDWR) == 0) { + if (spw_open (read_only ? O_RDONLY : O_RDWR) == 0) { fprintf (stderr, _("%s: cannot open %s\n"), Prog, spw_dbname ()); if (use_system_spw_file) { @@ -566,7 +566,7 @@ static void check_pw_file (int *errors, bool *changed) continue; } spw_locked = true; - if (spw_open (read_only ? O_RDONLY : O_CREAT | O_RDWR) == 0) { + if (spw_open (read_only ? O_RDONLY : O_RDWR) == 0) { fprintf (stderr, _("%s: cannot open %s\n"), Prog, spw_dbname ());