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 <shallyn@cisco.com>
This commit is contained in:
parent
b63aca9a2c
commit
d3790feac0
@ -281,7 +281,7 @@ static void open_files (void)
|
|||||||
* Open the files. Use O_RDONLY if we are in read_only mode, O_RDWR
|
* Open the files. Use O_RDONLY if we are in read_only mode, O_RDWR
|
||||||
* otherwise.
|
* 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"),
|
fprintf (stderr, _("%s: cannot open %s\n"),
|
||||||
Prog, pw_dbname ());
|
Prog, pw_dbname ());
|
||||||
if (use_system_pw_file) {
|
if (use_system_pw_file) {
|
||||||
@ -290,7 +290,7 @@ static void open_files (void)
|
|||||||
fail_exit (E_CANTOPEN);
|
fail_exit (E_CANTOPEN);
|
||||||
}
|
}
|
||||||
if (is_shadow && !use_tcb) {
|
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"),
|
fprintf (stderr, _("%s: cannot open %s\n"),
|
||||||
Prog, spw_dbname ());
|
Prog, spw_dbname ());
|
||||||
if (use_system_spw_file) {
|
if (use_system_spw_file) {
|
||||||
@ -566,7 +566,7 @@ static void check_pw_file (int *errors, bool *changed)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
spw_locked = true;
|
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,
|
fprintf (stderr,
|
||||||
_("%s: cannot open %s\n"),
|
_("%s: cannot open %s\n"),
|
||||||
Prog, spw_dbname ());
|
Prog, spw_dbname ());
|
||||||
|
Loading…
Reference in New Issue
Block a user