shithub: riscv

Download patch

ref: 31ed86ce239e3be6233cd707e838b5e1c834edfa
parent: 7fdf8205891496554b18650596334e28dc3366ed
author: cinap_lenrek <[email protected]>
date: Fri Aug 17 14:14:34 EDT 2012

webcookies: create $home/lib/webcookies as 0600

--- a/sys/src/cmd/webcookies.c
+++ b/sys/src/cmd/webcookies.c
@@ -1216,6 +1216,7 @@
 main(int argc, char **argv)
 {
 	char *file, *mtpt, *home, *srv;
+	int fd;
 
 	file = nil;
 	srv = nil;
@@ -1255,9 +1256,12 @@
 		strcpy(file, home);
 		strcat(file, "/lib/webcookies");
 	}
-	if(access(file, AEXIST) < 0)
-		close(create(file, OWRITE, 0666));
-
+	if(access(file, AEXIST) < 0){
+		if((fd = create(file, OWRITE, 0600)) < 0)
+			sysfatal("create %s: %r", file);
+		close(fd);
+	}
+			
 	jar = readjar(file);
 	if(jar == nil)
 		sysfatal("readjar: %r");