From 5af5a723bfa9a3da2df754e63a3833445ecdb49b Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 22 Aug 2020 07:53:38 +0200 Subject: bookmarks: Check for access before reading, remove homepage --- bookmarks.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bookmarks.c b/bookmarks.c index 59faf95..dcf579d 100644 --- a/bookmarks.c +++ b/bookmarks.c @@ -6,6 +6,7 @@ #include /* g_fprintf() */ #include #include +#include /* 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); -- cgit v1.3.1-23-gd82d