about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJosh Rickmar <jrick@devio.us>2012-05-22 13:57:57 -0400
committerJosh Rickmar <jrick@devio.us>2012-05-23 10:00:53 -0400
commit3510d5c58552f57545bcb9cc273b97fa98acc1b4 (patch)
tree62e9e6eb487003a950a19cb24f7a442a87c8c662
parentd09357035fd1d56441cd1f56fa7c9f0f509fd63e (diff)
downloadxombrero-3510d5c58552f57545bcb9cc273b97fa98acc1b4.tar.gz
Truncate the startofday file before writing the current version to it.
Noticed and patched by henrix@camandro.org.
-rw-r--r--xombrero.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xombrero.c b/xombrero.c
index 4ede076..99e956f 100644
--- a/xombrero.c
+++ b/xombrero.c
@@ -7902,7 +7902,8 @@ main(int argc, char **argv)
 			err(1, "fgets");
 		sodversion[strcspn(sodversion, "\n")] = '\0';
 		if (strcmp(version, sodversion)) {
-			rewind(f);
+			if ((f = freopen(file, "w", f)) == NULL)
+				err(1, "startofday");
 			if (fputs(version, f) == EOF)
 				err(1, "fputs");