vb.files[FILES_CONFIG] = g_strdup(rp);
free(rp);
} else {
- vb.files[FILES_CONFIG] = util_get_filepath(path, "config", FALSE);
+ vb.files[FILES_CONFIG] = util_get_filepath(path, "config", FALSE, 0600);
}
/* Setup those files that are use multiple time during runtime */
- vb.files[FILES_CLOSED] = util_get_filepath(path, "closed", TRUE);
- vb.files[FILES_COOKIE] = util_get_filepath(path, "cookies.db", TRUE);
- vb.files[FILES_USER_STYLE] = util_get_filepath(path, "style.css", FALSE);
- vb.files[FILES_SCRIPT] = util_get_filepath(path, "scripts.js", FALSE);
- vb.files[FILES_HISTORY] = util_get_filepath(path, "history", TRUE);
- vb.files[FILES_COMMAND] = util_get_filepath(path, "command", TRUE);
- vb.files[FILES_BOOKMARK] = util_get_filepath(path, "bookmark", TRUE);
- vb.files[FILES_QUEUE] = util_get_filepath(path, "queue", TRUE);
- vb.files[FILES_SEARCH] = util_get_filepath(path, "search", TRUE);
+ vb.files[FILES_CLOSED] = util_get_filepath(path, "closed", TRUE, 0600);
+ vb.files[FILES_COOKIE] = util_get_filepath(path, "cookies.db", TRUE, 0600);
+ vb.files[FILES_USER_STYLE] = util_get_filepath(path, "style.css", FALSE, 0600);
+ vb.files[FILES_SCRIPT] = util_get_filepath(path, "scripts.js", FALSE, 0600);
+ vb.files[FILES_HISTORY] = util_get_filepath(path, "history", TRUE, 0600);
+ vb.files[FILES_COMMAND] = util_get_filepath(path, "command", TRUE, 0600);
+ vb.files[FILES_BOOKMARK] = util_get_filepath(path, "bookmark", TRUE, 0600);
+ vb.files[FILES_QUEUE] = util_get_filepath(path, "queue", TRUE, 0600);
+ vb.files[FILES_SEARCH] = util_get_filepath(path, "search", TRUE, 0600);
g_free(path);
/* Use seperate rendering processed for the webview of the clients in the
* @dir: Directory in which the file is searched.
* @filename: Filename to built the absolute path with.
* @create: If TRUE, the file is created if it does not already exist.
+ * @mode: Mode (file permission as chmod(2)) used for the file when creating it.
*/
-char *util_get_filepath(const char *dir, const char *filename, gboolean create)
+char *util_get_filepath(const char *dir, const char *filename, gboolean create, int mode)
{
char *fullpath;
} else if (create) {
/* If create option was given - create the file. */
fclose(fopen(fullpath, "a"));
+ g_chmod(fullpath, mode);
return fullpath;
}
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_get_filepath(const char *dir, const char *filename, gboolean create);
+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,
guint max_items);