logo

badwolf

minimalist and privacy-oriented web browser based on WebKitGTK git clone https://hacktivis.me/git/badwolf.git
commit: 5af5a723bfa9a3da2df754e63a3833445ecdb49b
parent 720eb415a73893bf4c3894c10e27c66996f7e67e
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 22 Aug 2020 07:53:38 +0200

bookmarks: Check for access before reading, remove homepage

Diffstat:

Mbookmarks.c7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bookmarks.c b/bookmarks.c @@ -6,6 +6,7 @@ #include <glib/gprintf.h> /* g_fprintf() */ #include <gtk/gtk.h> #include <libxml/xpath.h> +#include <unistd.h> /* access() */ static gboolean location_completion_matches(GtkEntryCompletion *completion, @@ -76,8 +77,10 @@ bookmarks_completion_init() GtkTreeIter iter; GtkListStore *list_store = gtk_list_store_new(1, G_TYPE_STRING); - gtk_list_store_append(list_store, &iter); - gtk_list_store_set(list_store, &iter, 0, homepage, -1); + if(access(filename, R_OK) != 0) { + g_fprintf(stderr, "Bookmarks: No loadable file found at %s\n", filename); + return NULL; + } g_fprintf(stderr, "Bookmarks: loading at %s\n", filename); doc = xmlParseFile(filename);