Report an error if deleting a random seed file fails.
[sgt/putty] / windows / winstore.c
index c165676..66c7c75 100644 (file)
@@ -230,21 +230,20 @@ void write_setting_fontspec(void *handle, const char *name, FontSpec *font)
     sfree(settingname);
 }
 
-int read_setting_filename(void *handle, const char *name, Filename *result)
+Filename *read_setting_filename(void *handle, const char *name)
 {
     char *tmp = read_setting_s(handle, name);
     if (tmp) {
-       strncpy(result->path, tmp, sizeof(result->path)-1);
-       result->path[sizeof(result->path)-1] = '\0';
+        Filename *ret = filename_from_str(tmp);
        sfree(tmp);
-       return TRUE;
+       return ret;
     } else
-       return FALSE;
+       return NULL;
 }
 
-void write_setting_filename(void *handle, const char *name, Filename result)
+void write_setting_filename(void *handle, const char *name, Filename *result)
 {
-    write_setting_s(handle, name, result.path);
+    write_setting_s(handle, name, result->path);
 }
 
 void close_settings_r(void *handle)
@@ -457,7 +456,10 @@ enum { DEL, OPEN_R, OPEN_W };
 static int try_random_seed(char const *path, int action, HANDLE *ret)
 {
     if (action == DEL) {
-       remove(path);
+        if (!DeleteFile(path) && GetLastError() != ERROR_FILE_NOT_FOUND) {
+            nonfatal("Unable to delete '%s': %s", path,
+                     win_strerror(GetLastError()));
+        }
        *ret = INVALID_HANDLE_VALUE;
        return FALSE;                  /* so we'll do the next ones too */
     }