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/vipw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'login-utils/vipw.c') diff --git a/login-utils/vipw.c b/login-utils/vipw.c index 66c682dc0..a5982813b 100644 --- a/login-utils/vipw.c +++ b/login-utils/vipw.c @@ -143,8 +143,9 @@ static FILE * pw_tmpfile(int lockfd) { FILE *fd; char *tmpname = NULL; + char *dir = "/etc"; - if ((fd = xfmkstemp(&tmpname)) == NULL) { + if ((fd = xfmkstemp(&tmpname, dir)) == NULL) { ulckpwdf(); err(EXIT_FAILURE, _("can't open temporary file")); } -- cgit v1.2.3-55-g7522