g_string_append_printf(new, "%s\n", line);
         }
         g_strfreev(lines);
-        util_file_set_content(vb.files[FILES_BOOKMARK], new->str, 0600);
+        util_file_set_content(vb.files[FILES_BOOKMARK], new->str);
         g_string_free(new, TRUE);
     }
 
  */
 char *bookmark_queue_pop(int *item_count)
 {
-    return util_file_pop_line(vb.files[FILES_QUEUE], item_count, 0600);
+    return util_file_pop_line(vb.files[FILES_QUEUE], item_count);
 }
 
 /**
 
      * exists. */
     if (c->state.uri && vb.config.closed_max && vb.files[FILES_CLOSED]) {
         util_file_prepend_line(vb.files[FILES_CLOSED], c->state.uri,
-                vb.config.closed_max, 0600);
+                vb.config.closed_max);
     }
 
     gtk_widget_destroy(c->window);
 
     }
 
     a.i = info->key == 'U' ? TARGET_NEW : TARGET_CURRENT;
-    a.s = util_file_pop_line(vb.files[FILES_CLOSED], NULL, 0600);
+    a.s = util_file_pop_line(vb.files[FILES_CLOSED], NULL);
     if (!a.s) {
         return RESULT_ERROR;
     }
 
  * @line:       Line to be written as new first line into the file.
  *              The line ending is inserted automatic.
  * @max_lines   Maximum number of lines in file after the operation.
- * @mode        Mode (file permission as chmod(2)) used for the file when
- *              creating it.
  */
 void util_file_prepend_line(const char *file, const char *line,
-        unsigned int max_lines, int mode)
+        unsigned int max_lines)
 {
     char **lines;
     GString *new_content;
         }
         g_strfreev(lines);
     }
-    util_file_set_content(file, new_content->str, mode);
+    util_file_set_content(file, new_content->str);
     g_string_free(new_content, TRUE);
 }
 
  * @file:       file to read from
  * @item_count: will be filled with the number of remaining lines in file if it
  *              is not NULL.
- * @mode        Mode (file permission as chmod(2)) used for the file when
- *              creating it.
  *
  * Returned string must be freed with g_free.
  */
-char *util_file_pop_line(const char *file, int *item_count, int mode)
+char *util_file_pop_line(const char *file, int *item_count)
 {
     char **lines;
     char *new,
             /* minus one for last empty item and one for popped item */
             count = len - 2;
             new   = g_strjoinv("\n", lines + 1);
-            util_file_set_content(file, new, mode);
+            util_file_set_content(file, new);
             g_free(new);
         }
         g_strfreev(lines);
  * Atomicly writes contents to given file.
  * Returns TRUE on success, FALSE otherwise.
  */
-char *util_file_set_content(const char *file, const char *contents, int mode)
+char *util_file_set_content(const char *file, const char *contents)
 {
     gboolean retval = FALSE;
     char *tmp_name;
-    int fd;
+    int fd, mode;
     gsize length;
+    struct stat st;
+
+    mode = 0600;
+    if (stat(file, &st) == 0)
+        mode = st.st_mode;
 
     /* Create a temporary file. */
     tmp_name = g_strconcat(file, ".XXXXXX", NULL);
 
 gboolean util_file_append(const char *file, const char *format, ...);
 gboolean util_file_prepend(const char *file, const char *format, ...);
 void util_file_prepend_line(const char *file, const char *line,
-        unsigned int max_lines, int mode);
-char *util_file_pop_line(const char *file, int *item_count, int mode);
+        unsigned int max_lines);
+char *util_file_pop_line(const char *file, int *item_count);
 char *util_get_config_dir(void);
 char *util_get_file_contents(const char *filename, gsize *length);
-char *util_file_set_content(const char *file, const char *contents, int mode);
+char *util_file_set_content(const char *file, const char *contents);
 char *util_get_filepath(const char *dir, const char *filename, gboolean create, int mode);
 char **util_get_lines(const char *filename);
 GList *util_file_to_unique_list(const char *filename, Util_Content_Func func,