commit: 94bc1e381baacba8a45f5782f368af11eff279a7
parent: 446003a4e1b7f8e0673e361f1691d72d8a378173
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 15 Dec 2019 19:33:19 +0100
badwolf.c: Fix access() usage
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
@@ -19,7 +19,7 @@ DOCS = usr.bin.badwolf README.md KnowledgeBase.md
CC = cc
CFLAGS = -g -Wall -Wextra -Wconversion -Wsign-conversion
-CDEPS = `pkg-config --cflags $(DEPS)` -DDATADIR=\"$(DATADIR)\" -DPACKAGE=\"$(PACKAGE)\" -D_DEFAULT_SOURCE -DVERSION=\"$(VERSION_FULL)\"
+CDEPS = `pkg-config --cflags $(DEPS)` -DDATADIR=\"$(DATADIR)\" -DPACKAGE=\"$(PACKAGE)\" -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION_FULL)\"
LIBS = `pkg-config --libs $(DEPS)`
all: $(EXE) $(TRANS)
diff --git a/badwolf.c b/badwolf.c
@@ -11,7 +11,8 @@
#include <glib/gprintf.h> /* g_fprintf() */
#include <libsoup/soup.h> /* soup* */
#include <locale.h> /* LC_* */
-#include <stdlib.h> /* realpath(), malloc() */
+#include <stdlib.h> /* malloc() */
+#include <unistd.h> /* access() */
const gchar *homepage = "https://hacktivis.me/projects/badwolf";
const gchar *version = VERSION;
@@ -67,7 +68,7 @@ badwolf_ensure_uri_scheme(const gchar *text, gboolean try_file)
{
SoupURI *uri = soup_uri_new(text);
- if(uri->path == NULL)
+ if(uri->path == NULL || text == NULL)
{
soup_uri_free(uri);
return "about:blank";