diff options
author | Sami Kerola | 2012-03-10 12:29:35 +0100 |
---|---|---|
committer | Sami Kerola | 2012-03-18 14:29:38 +0100 |
commit | 7961acce46283a29bd9e7629e515908848f8c9e1 (patch) | |
tree | 1d51f8d8ddf4959ace301df56d70e35248b65877 /login-utils | |
parent | lslocks: use xasprintf for safe allocation (diff) | |
download | kernel-qcow2-util-linux-7961acce46283a29bd9e7629e515908848f8c9e1.tar.gz kernel-qcow2-util-linux-7961acce46283a29bd9e7629e515908848f8c9e1.tar.xz kernel-qcow2-util-linux-7961acce46283a29bd9e7629e515908848f8c9e1.zip |
fileutils: differentiate xmkstemp and xfmkstemp
Let developer to choose, case by case, what sort of return value is
best in her code. The xmkstemp() is for users who want file
descriptor as return value of the function, xfmkstemp() will return
FILE pointer.
Proposed-By: Karel Zak <kzak@redhat.com>
CC: Davidlohr Bueso <dave@gnu.org>
Reference: http://marc.info/?l=util-linux-ng&m=133129570124003&w=2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'login-utils')
-rw-r--r-- | login-utils/setpwnam.c | 4 | ||||
-rw-r--r-- | login-utils/vipw.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/login-utils/setpwnam.c b/login-utils/setpwnam.c index 6f3f4920a..7459fe298 100644 --- a/login-utils/setpwnam.c +++ b/login-utils/setpwnam.c @@ -83,7 +83,7 @@ int setpwnam(struct passwd *pwd) pw_init(); - if ((fp = xmkstemp(&tmpname)) == NULL) + if ((fp = xfmkstemp(&tmpname)) == NULL) return -1; /* ptmp should be owned by root.root or root.wheel */ @@ -140,7 +140,7 @@ int setpwnam(struct passwd *pwd) fputs(linebuf, fp); } - /* xmkstemp is too restrictive by default for passwd file */ + /* xfmkstemp is too restrictive by default for passwd file */ if (fchmod(fileno(fp), 0644) < 0) goto fail; rc = fclose(fp); diff --git a/login-utils/vipw.c b/login-utils/vipw.c index 765d11120..29e485cc4 100644 --- a/login-utils/vipw.c +++ b/login-utils/vipw.c @@ -143,7 +143,7 @@ static FILE * pw_tmpfile(int lockfd) FILE *fd; char *tmpname = NULL; - if ((fd = xmkstemp(&tmpname)) == NULL) { + if ((fd = xfmkstemp(&tmpname)) == NULL) { ulckpwdf(); err(EXIT_FAILURE, _("can't open temporary file")); } |