[hackers] [surf] making cookie file creation a bit more pedantic || anselm

From: <hg_AT_suckless.org>
Date: Sat, 11 Feb 2012 17:51:44 +0100 (CET)

changeset: 237:7a38aa5d9a46
tag: tip
user: anselm_AT_garbe.us
date: Sat Feb 11 17:51:48 2012 +0100
files: surf.c
description:
making cookie file creation a bit more pedantic


diff -r 89c3b15cd2d6 -r 7a38aa5d9a46 surf.c
--- a/surf.c Sat Feb 11 10:40:32 2012 +0100
+++ b/surf.c Sat Feb 11 17:51:48 2012 +0100
_AT_@ -128,11 +128,14 @@
         if((p = strrchr(apath, '/'))) {
                 *p = '\0';
                 g_mkdir_with_parents(apath, 0700);
+ g_chmod(apath, 0700); /* in case it existed */
                 *p = '/';
         }
         /* creating file (gives error when apath ends with "/") */
- if((f = fopen(apath, "a")))
+ if((f = fopen(apath, "a"))) {
+ g_chmod(apath, 0600); /* always */
                 fclose(f);
+ }
         return apath;
 }
 
Received on Sat Feb 11 2012 - 17:51:44 CET

This archive was generated by hypermail 2.3.0 : Sat Feb 11 2012 - 18:00:13 CET