shithub: gefs

Download patch

ref: 56d87e3e608c8850343b650809f159fee3fc4bf1
parent: bbc98169d5712dc73dfc9f880546799e77fd3030
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Nov 16 20:31:03 EST 2023

main: fix permissions on files

--- a/main.c
+++ b/main.c
@@ -75,7 +75,7 @@
 }
 
 static int
-postfd(char *name, char *suff)
+postfd(char *name, char *suff, int mode)
 {
 	char buf[80];
 	int fd[2];
@@ -84,7 +84,7 @@
 	if(pipe(fd) < 0)
 		sysfatal("can't make a pipe");
 	snprint(buf, sizeof buf, "/srv/%s%s", name, suff);
-	if((cfd = create(buf, OWRITE|ORCLOSE|OCEXEC, 0600)) == -1)
+	if((cfd = create(buf, OWRITE|ORCLOSE|OCEXEC, mode)) == -1)
 		sysfatal("create %s: %r", buf);
 	if(fprint(cfd, "%d", fd[0]) == -1)
 		sysfatal("write %s: %r", buf);
@@ -241,8 +241,8 @@
 		fs->rdchan[i] = mkchan(32);
 	for(i = 0; i < fs->narena; i++)
 		fs->arenas[i].sync = &fs->syncq[i%fs->nsyncers];
-	srvfd = postfd(srvname, "");
-	ctlfd = postfd(srvname, ".cmd");
+	srvfd = postfd(srvname, "", 0666);
+	ctlfd = postfd(srvname, ".cmd", 0600);
 	launch(runcons, (void*)ctlfd, "ctl");
 	launch(runwrite, nil, "mutate");
 	launch(runsweep, nil, "sweep");