summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2011-02-10 21:31:36 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2011-02-10 21:31:36 -0500
commite615815e1d0f299b0639a5b2bebebd147a1bf22b (patch)
tree49b62f2faa880d2845627abd0f3f1fbb884444e2
parentAdd rudimentry host filter. (diff)
downloadlastlog-e615815e1d0f299b0639a5b2bebebd147a1bf22b.tar.xz
lastlog-e615815e1d0f299b0639a5b2bebebd147a1bf22b.zip
Build optimized and suppress warning on write error.
-rw-r--r--Makefile2
-rw-r--r--utmpr.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 8973308..3c870d8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CFLAGS=-g
+CFLAGS=-O2 -Wall
utmpr:
clean:
rm -f utmpr
diff --git a/utmpr.c b/utmpr.c
index 3456d0c..a111f74 100644
--- a/utmpr.c
+++ b/utmpr.c
@@ -198,7 +198,10 @@ void text_to_binary(FILE *fp)
(ip_n[0]));
//TODO: ipv6 addresses...
- fwrite(&entry, sizeof(struct utmp), 1, output_file);
+ if (!fwrite(&entry, sizeof(struct utmp), 1, output_file)) {
+ fprintf(stderr, "%s: Could not write output\n", program_name);
+ exit(EXIT_FAILURE);
+ }
}
}