Commits

Ragnara  committed 3f52848

Do not overwrite files that are not valid buildcounter output

  • Participants
  • Parent commits 7a8e42d

Comments (0)

Files changed (2)

File buildcounter.c

 
     if ((file = fopen(filename, "r")))
     {
-        fscanf(file, format, &lastbuild);
+        int res = fscanf(file, format, &lastbuild);
         fclose(file);
+
+        if (res != 1)
+        {
+            fprintf(stderr, "File %s does not look like buildcounter output\n", filename);
+            exit(1);
+        }
     }
 
     if ((file = fopen(filename, "w")))
-#define BUILDNO 18
+#define BUILDNO 19