From 426e8b3799be260193150c5c0a8d7cbc41d7bf03 Mon Sep 17 00:00:00 2001 From: David Crosby Date: Sat, 25 Jul 2015 22:20:39 -0600 Subject: Check return value of rename --- history.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'history.c') diff --git a/history.c b/history.c index e9be09b..f2a00b4 100644 --- a/history.c +++ b/history.c @@ -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; @@ -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 */ -- cgit v1.2.3