Check return value of rename
This commit is contained in:
committed by
Tatsuya Kinoshita
parent
fc5b50353e
commit
426e8b3799
@@ -60,6 +60,7 @@ saveHistory(Hist *hist, size_t size)
|
|||||||
FILE *f;
|
FILE *f;
|
||||||
HistItem *item;
|
HistItem *item;
|
||||||
char *tmpf;
|
char *tmpf;
|
||||||
|
int rename_ret;
|
||||||
|
|
||||||
if (hist == NULL || hist->list == NULL)
|
if (hist == NULL || hist->list == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -79,7 +80,11 @@ saveHistory(Hist *hist, size_t size)
|
|||||||
disp_err_message("Can't save history", FALSE);
|
disp_err_message("Can't save history", FALSE);
|
||||||
return;
|
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 */
|
#endif /* USE_HISTORY */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user