Skip to content

Commit

Permalink
Check return value of rename
Browse files Browse the repository at this point in the history
  • Loading branch information
dafyddcrosby authored and tats committed Aug 11, 2015
1 parent fc5b503 commit 426e8b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion history.c
Expand Up @@ -60,6 +60,7 @@ saveHistory(Hist *hist, size_t size)
FILE *f;
HistItem *item;
char *tmpf;
int rename_ret;

if (hist == NULL || hist->list == NULL)
return;
Expand All @@ -79,7 +80,11 @@ saveHistory(Hist *hist, size_t size)
disp_err_message("Can't save history", FALSE);
return;
}
rename(tmpf, rcFile(HISTORY_FILE));
rename_ret = rename(tmpf, rcFile(HISTORY_FILE));
if (rename_ret != 0) {
disp_err_message("Can't save history", FALSE);
return;
}
}
#endif /* USE_HISTORY */

Expand Down

0 comments on commit 426e8b3

Please sign in to comment.