Currently the logdir will be created only if logfile does contain a
string. To add another logfiles we simple create the logdir always on
startup.
---
 dlm_controld/logging.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/dlm_controld/logging.c b/dlm_controld/logging.c
index 2c57138c..3298ef99 100644
--- a/dlm_controld/logging.c
+++ b/dlm_controld/logging.c
@@ -38,27 +38,27 @@ void init_logging(void)
 
        set_logfile_priority();
 
-       if (logfile[0]) {
-               old_umask = umask(0077);
-               rv = mkdir(SYS_VARDIR, 0700);
-               if (rv < 0 && errno != EEXIST) {
-                       umask(old_umask);
-                       goto skip_logfile;
-               }
+       old_umask = umask(0077);
+       rv = mkdir(SYS_VARDIR, 0700);
+       if (rv < 0 && errno != EEXIST) {
+               umask(old_umask);
+               goto skip_logfile;
+       }
 
-               rv = mkdir(SYS_LOGDIR, 0700);
-               if (rv < 0 && errno != EEXIST) {
-                       umask(old_umask);
-                       goto skip_logfile;
-               }
+       rv = mkdir(SYS_LOGDIR, 0700);
+       if (rv < 0 && errno != EEXIST) {
+               umask(old_umask);
+               goto skip_logfile;
+       }
 
-               rv = mkdir(LOGDIR, 0700);
-               if (rv < 0 && errno != EEXIST) {
-                       umask(old_umask);
-                       goto skip_logfile;
-               }
+       rv = mkdir(LOGDIR, 0700);
+       if (rv < 0 && errno != EEXIST) {
                umask(old_umask);
+               goto skip_logfile;
+       }
+       umask(old_umask);
 
+       if (logfile[0]) {
                logfile_fp = fopen(logfile, "a+");
                if (logfile_fp != NULL) {
                        int fd = fileno(logfile_fp);
-- 
2.31.1

Reply via email to