From 19f12b01a47c559ac7b05303540a83217d6ebff2 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 23 Jan 2015 12:14:37 +0000 Subject: Fix failure to save hotlist when there was no previous file. --- desktop/hotlist.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/desktop/hotlist.c b/desktop/hotlist.c index 661b999ea..dce5430b4 100644 --- a/desktop/hotlist.c +++ b/desktop/hotlist.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -913,7 +914,6 @@ static nserror hotlist_generate(void) } - /* Save the hotlist to to a file at the given path * * \param path Path to save hostlist file to. @@ -938,8 +938,13 @@ static nserror hotlist_save(const char *path) /* Remove old hotlist file, and replace */ if (remove(path) != 0) { - res = NSERROR_SAVE_FAILED; - goto cleanup; + if (errno == ENOENT) { + /* There was no original file to remove. */ + } else { + res = NSERROR_SAVE_FAILED; + LOG(("Error: %s.", strerror(errno))); + goto cleanup; + } } if (rename(temp_path, path) != 0) { res = NSERROR_SAVE_FAILED; -- cgit v1.2.3