summaryrefslogtreecommitdiffstats
path: root/login-utils/setpwnam.c
diff options
context:
space:
mode:
authorKarel Zak2012-04-11 12:52:36 +0200
committerKarel Zak2012-04-11 12:52:36 +0200
commit1b1af0c1d07fe8bc666882b0ae63ef9391e9d376 (patch)
treeb5fc009b3ee5955293d50e67e26248fd554de195 /login-utils/setpwnam.c
parentMerge branch 'close_stream' of git://github.com/kerolasa/lelux-utiliteetit (diff)
downloadkernel-qcow2-util-linux-1b1af0c1d07fe8bc666882b0ae63ef9391e9d376.tar.gz
kernel-qcow2-util-linux-1b1af0c1d07fe8bc666882b0ae63ef9391e9d376.tar.xz
kernel-qcow2-util-linux-1b1af0c1d07fe8bc666882b0ae63ef9391e9d376.zip
login-utils: add missing header, fix setpwnam.c fclose logic
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/setpwnam.c')
-rw-r--r--login-utils/setpwnam.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/login-utils/setpwnam.c b/login-utils/setpwnam.c
index ba15bc131..44dda98e7 100644
--- a/login-utils/setpwnam.c
+++ b/login-utils/setpwnam.c
@@ -59,6 +59,7 @@
#include <unistd.h>
#include "c.h"
+#include "fileutils.h"
#include "closestream.h"
#include "setpwnam.h"
@@ -143,7 +144,9 @@ int setpwnam(struct passwd *pwd)
/* xfmkstemp is too restrictive by default for passwd file */
if (fchmod(fileno(fp), 0644) < 0)
goto fail;
- if (close_stream(fp) != 0)
+ rc = close_stream(fp);
+ fp = NULL;
+ if (rc != 0)
goto fail;
fclose(pwf); /* I don't think I want to know if this failed */