summaryrefslogtreecommitdiffstats
path: root/login-utils/setpwnam.c
diff options
context:
space:
mode:
authorSami Kerola2012-04-04 19:58:34 +0200
committerSami Kerola2012-04-04 19:58:34 +0200
commit439cdf1e2475d2f6622c151419f90c7da6de1434 (patch)
treec7e0fac0bef7831d7603fd95e8ff30cc805843da /login-utils/setpwnam.c
parentmisc-utils: verify writing to streams was successful (diff)
downloadkernel-qcow2-util-linux-439cdf1e2475d2f6622c151419f90c7da6de1434.tar.gz
kernel-qcow2-util-linux-439cdf1e2475d2f6622c151419f90c7da6de1434.tar.xz
kernel-qcow2-util-linux-439cdf1e2475d2f6622c151419f90c7da6de1434.zip
login-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'login-utils/setpwnam.c')
-rw-r--r--login-utils/setpwnam.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/login-utils/setpwnam.c b/login-utils/setpwnam.c
index 7459fe298..ba15bc131 100644
--- a/login-utils/setpwnam.c
+++ b/login-utils/setpwnam.c
@@ -59,7 +59,7 @@
#include <unistd.h>
#include "c.h"
-#include "fileutils.h"
+#include "closestream.h"
#include "setpwnam.h"
static void pw_init(void);
@@ -143,9 +143,7 @@ int setpwnam(struct passwd *pwd)
/* xfmkstemp is too restrictive by default for passwd file */
if (fchmod(fileno(fp), 0644) < 0)
goto fail;
- rc = fclose(fp);
- fp = NULL;
- if (rc < 0)
+ if (close_stream(fp) != 0)
goto fail;
fclose(pwf); /* I don't think I want to know if this failed */