From 40ac7b1dd6474373ceb742a5b754f6e95ec69151 Mon Sep 17 00:00:00 2001 From: Tim Pepper Date: Thu, 27 Sep 2012 17:25:39 -0700 Subject: [PATCH] Always chmod our directories. I observed the the modes of corewatcher's directories had changed on one of my systems. I don't know what would have caused that, but it led to cores not being recorded in the filesystem. To be robust we create the directories if for some reason they do not exist at start up. Similarly, try to always insure they have the correct permissions at start up. Signed-off-by: Tim Pepper --- src/corewatcher.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corewatcher.c b/src/corewatcher.c index 983d3c6..457eb1a 100644 --- a/src/corewatcher.c +++ b/src/corewatcher.c @@ -197,11 +197,11 @@ int main(int argc, char**argv) dir = opendir(core_folder); if (!dir) { mkdir(core_folder, S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX); - chmod(core_folder, S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX); dir = opendir(core_folder); if (!dir) return 1; } + chmod(core_folder, S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX); closedir(dir); dir = opendir(processed_folder); if (!dir) { @@ -211,6 +211,7 @@ int main(int argc, char**argv) if (!dir) return 1; } + chmod(processed_folder, S_IRWXU); closedir(dir); while (1) { -- 2.7.4