From 3c4fed097ddb65dbe3d88f60caee78fb60756f3e Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 2 Jun 2012 19:31:30 +0200 Subject: fileutils: xmkstemp() interface change We can not let the user control where TMPDIR is for this tempfile. This will be where we write the updated passwd file, and must be capable of being moved atomically with rename(2). Therefore, it cannot be on a different device, or setpwnam() and vipw/vigr programs will invariably fail with EXDEV. Signed-off-by: Dave Reisner Signed-off-by: Sami Kerola --- login-utils/setpwnam.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'login-utils/setpwnam.c') diff --git a/login-utils/setpwnam.c b/login-utils/setpwnam.c index 44dda98e7..23aef532d 100644 --- a/login-utils/setpwnam.c +++ b/login-utils/setpwnam.c @@ -81,10 +81,11 @@ int setpwnam(struct passwd *pwd) int contlen, rc; char *linebuf = NULL; char *tmpname = NULL; + char *atomic_dir = "/etc"; pw_init(); - if ((fp = xfmkstemp(&tmpname)) == NULL) + if ((fp = xfmkstemp(&tmpname, atomic_dir)) == NULL) return -1; /* ptmp should be owned by root.root or root.wheel */ -- cgit v1.2.3-55-g7522