Fixed some portability issues for Windows.

This commit is contained in:
Andrea Mazzoleni 2011-03-20 13:54:05 +01:00
parent bb350beb63
commit 8fb43ddefa
9 changed files with 688 additions and 37 deletions

View file

@ -179,7 +179,7 @@ void state_read(struct snapraid_state* state)
count_block = 0;
pathcpy(path, sizeof(path), state->content);
f = fopen(state->content, "r");
f = fopen(state->content, "rt");
if (!f) {
/* if not found, assume empty */
if (errno == ENOENT)
@ -397,7 +397,7 @@ void state_write(struct snapraid_state* state)
printf("Saving state...\n");
pathprint(path, sizeof(path), "%s.tmp", state->content);
f = fopen(path, "w");
f = fopen(path, "wt");
if (!f) {
fprintf(stderr, "Error opening for writing the content file '%s'\n", path);
exit(EXIT_FAILURE);