[hackers] [ubase] More error checking for fwrite() || sin
commit 3669fa411773c56044b0e9027fdcc6290631a173
Author: sin <sin_AT_2f30.org>
Date: Wed Jul 2 11:51:30 2014 +0100
More error checking for fwrite()
diff --git a/login.c b/login.c
index eca23c8..ef6d501 100644
--- a/login.c
+++ b/login.c
_AT_@ -91,7 +91,9 @@ main(int argc, char *argv[])
fp = fopen(UTMP_PATH, "a");
if (!fp)
weprintf("fopen %s:", UTMP_PATH);
- fwrite(&usr, sizeof(usr), 1, fp);
+ if (fwrite(&usr, sizeof(usr), 1, fp) != 1)
+ if (ferror(fp))
+ weprintf("%s: write error:", UTMP_PATH);
fclose(fp);
return dologin(pw, pflag);
Received on Wed Jul 02 2014 - 13:06:31 CEST
This archive was generated by hypermail 2.3.0
: Wed Jul 02 2014 - 13:12:16 CEST