aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Crosby <dave@dafyddcrosby.com>2015-07-26 04:20:39 +0000
committerTatsuya Kinoshita <tats@debian.org>2015-08-11 12:59:27 +0000
commit426e8b3799be260193150c5c0a8d7cbc41d7bf03 (patch)
tree3002d0e8e6e70ba6184b63ac4a738cd051884c7c
parentAdjust while loop (diff)
downloadw3m-426e8b3799be260193150c5c0a8d7cbc41d7bf03.tar.gz
w3m-426e8b3799be260193150c5c0a8d7cbc41d7bf03.zip
Check return value of rename
-rw-r--r--history.c7
1 files changed, 6 insertions, 1 deletions
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 */