making cookie file creation a bit more pedantic

This commit is contained in:
anselm@garbe.us 2012-02-11 17:51:48 +01:00
parent a0e269b6bd
commit 6af15aa636

5
surf.c
View File

@ -128,11 +128,14 @@ buildpath(const char *path) {
if((p = strrchr(apath, '/'))) { if((p = strrchr(apath, '/'))) {
*p = '\0'; *p = '\0';
g_mkdir_with_parents(apath, 0700); g_mkdir_with_parents(apath, 0700);
g_chmod(apath, 0700); /* in case it existed */
*p = '/'; *p = '/';
} }
/* creating file (gives error when apath ends with "/") */ /* 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); fclose(f);
}
return apath; return apath;
} }