summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2015-02-03 10:15:37 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2015-02-03 10:15:37 +0000
commitcf954f949427382d2f74862255730a370d800405 (patch)
tree0005533d2e11e30462be37a52c8147e5aadb9504
parent32cd4abfd5fde8a86397151fca922432c16fe297 (diff)
downloadnetsurf-cf954f949427382d2f74862255730a370d800405.tar.gz
netsurf-cf954f949427382d2f74862255730a370d800405.tar.bz2
The AmigaOS rename() isn't POSIX compiant, so call remove() first.
There will be a race condition on AmigaOS if a hostlist file gets created between the remove() and rename() calls.
-rw-r--r--desktop/hotlist.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/desktop/hotlist.c b/desktop/hotlist.c
index 7e14143ca..8f76c62a3 100644
--- a/desktop/hotlist.c
+++ b/desktop/hotlist.c
@@ -936,6 +936,9 @@ static nserror hotlist_save(const char *path)
goto cleanup;
}
+ /* Remove old hotlist to handle non-POSIX rename() implementations. */
+ (void)remove(path);
+
/* Replace any old hotlist file with the one we just saved */
if (rename(temp_path, path) != 0) {
res = NSERROR_SAVE_FAILED;