Browse Source

use O_CLOEXEC with open() instead of open/fcntl; from David Hill

ok otto
OPENBSD_5_4
okan 11 years ago
parent
commit
0b316e60e4
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/lib/libutil/check_expire.c

+ 3
- 3
src/lib/libutil/check_expire.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: check_expire.c,v 1.8 2004/04/20 23:21:23 millert Exp $ */
/* $OpenBSD: check_expire.c,v 1.9 2013/04/29 00:19:19 okan Exp $ */
/*
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
@ -173,8 +173,8 @@ pwd_update(const struct passwd *pwd, const struct passwd *opwd)
return("can't open passwd temp file");
}
pfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
if (pfd < 0 || fcntl(pfd, F_SETFD, 1) == -1) {
pfd = open(_PATH_MASTERPASSWD, O_RDONLY|O_CLOEXEC, 0);
if (pfd < 0) {
pw_abort();
return(strerror(errno));
}


Loading…
Cancel
Save