[pacman-dev] [PATCH] alpm_logaction: Unopenable logfile is an error only when not using syslog
This allows syslog to act as a fallback or a standalone logging destination. Fixes FS#38584. Signed-off-by: Zachary Cook <zachary.cook@uoit.net> --- lib/libalpm/log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c index d232bcc..19650dd 100644 --- a/lib/libalpm/log.c +++ b/lib/libalpm/log.c @@ -57,8 +57,8 @@ int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *prefix, if(fd >= 0) { handle->logstream = fdopen(fd, "a"); } - /* if we couldn't open it, we have an issue */ - if(fd < 0 || handle->logstream == NULL) { + /* if we couldn't open it, we have an issue when not using sylog */ + if((fd < 0 || handle->logstream == NULL) && !handle->usesyslog) { if(errno == EACCES) { handle->pm_errno = ALPM_ERR_BADPERMS; } else if(errno == ENOENT) { -- 1.8.5.3
See https://bugs.archlinux.org/task/38584 for more detail and a new patch, but this bug turns out to not prevent standalone syslog. The current logging just does not fallback to syslog if LogFile is invalid / unopenable, which is somewhat expected behavior, and is a lot less important. This patch would hide that error when UseSyslog is used, and so is not the correct thing to do. On Thu, Feb 6, 2014 at 4:55 PM, Zachary Cook <zachary.cook@uoit.net> wrote:
This allows syslog to act as a fallback or a standalone logging destination. Fixes FS#38584.
Signed-off-by: Zachary Cook <zachary.cook@uoit.net> --- lib/libalpm/log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c index d232bcc..19650dd 100644 --- a/lib/libalpm/log.c +++ b/lib/libalpm/log.c @@ -57,8 +57,8 @@ int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *prefix, if(fd >= 0) { handle->logstream = fdopen(fd, "a"); } - /* if we couldn't open it, we have an issue */ - if(fd < 0 || handle->logstream == NULL) { + /* if we couldn't open it, we have an issue when not using sylog */ + if((fd < 0 || handle->logstream == NULL) && !handle->usesyslog) { if(errno == EACCES) { handle->pm_errno = ALPM_ERR_BADPERMS; } else if(errno == ENOENT) { -- 1.8.5.3
participants (1)
-
Zachary Cook