From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Aring Date: Mon, 30 Jan 2023 14:24:31 -0500 Subject: [Cluster-devel] [PATCH dlm-tool 2/8] dlm_controld: always create logdir In-Reply-To: <20230130192437.3330300-1-aahringo@redhat.com> References: <20230130192437.3330300-1-aahringo@redhat.com> Message-ID: <20230130192437.3330300-2-aahringo@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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