summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2015-01-23 12:14:37 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2015-01-23 12:14:37 +0000
commit19f12b01a47c559ac7b05303540a83217d6ebff2 (patch)
tree6685d60ada8ff10d6eb03f8aa737448326245d9c
parent1b1acdd3c30e055fda07aa8526aa5a280e8a152e (diff)
downloadnetsurf-19f12b01a47c559ac7b05303540a83217d6ebff2.tar.gz
netsurf-19f12b01a47c559ac7b05303540a83217d6ebff2.tar.bz2
Fix failure to save hotlist when there was no previous file.
-rw-r--r--desktop/hotlist.c11
1 files 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 <http://www.gnu.org/licenses/>.
*/
+#include <errno.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@@ -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;