netsurf (2.8-2) fix-directory-create-permissions.patch

Summary

 netsurf-2.8/gtk/gui.c         |    4 +++-
 netsurf-2.8/utils/container.c |    4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

    
download this patch

Patch contents

--- a/netsurf-2.8/gtk/gui.c
+++ b/netsurf-2.8/gtk/gui.c
@@ -457,10 +457,12 @@
 	snprintf(buf, PATH_MAX, "%s/.netsurf", hdir);
 	if (access(buf, F_OK) != 0) {
 		LOG(("You don't have a ~/.netsurf - creating one for you."));
-		if (mkdir(buf, 0777) == -1) {
+		if (mkdir(buf, S_IRWXU) == -1) {
 			LOG(("Unable to create %s", buf));
 			die("NetSurf requires ~/.netsurf to exist, but it cannot be created.\n");
 		}
+	} else {
+		chmod(buf, S_IRWXU);
 	}
 }
 
--- a/netsurf-2.8/utils/container.c
+++ b/netsurf-2.8/utils/container.c
@@ -437,7 +437,7 @@
 		free(themename);
 		return NULL;
 	}
-	mkdir(dirname, 00777);
+	mkdir(dirname, S_IRWXU);
 
 	for (e = container_iterate(cctx, &state), i = 0; i < cctx->entries;
 			e = container_iterate(cctx, &state), i++) {
@@ -533,7 +533,7 @@
 		exit(1);
 	}
 
-	mkdir(dirname, 00777);
+	mkdir(dirname, S_IRWXU);
 
 	cctx = container_open(themefile);
 	if (cctx == NULL) {