Prevent the use of /dev/null for saving the content file. It's dangerous because it renames it!

This commit is contained in:
Andrea Mazzoleni 2011-06-26 21:19:41 +02:00
parent 14f34af1c7
commit 49cd2f3a7b

View file

@ -622,6 +622,10 @@ static void state_write_one(struct snapraid_state* state, const char* path, unsi
printf("Saving state to %s...\n", path);
/* ignore some special files */
if (strcmp(path, "/dev/null") == 0 || strcmp(path, "NUL") == 0)
return;
pathprint(tmp, sizeof(tmp), "%s.tmp", path);
f = fopen(tmp, "wt");
if (!f) {