[pacman-dev] [PATCH] alpm_logaction: Unopenable logfile is an error only when not using syslog

Zachary Cook zachary.cook at uoit.net
Thu Feb 6 16:55:37 EST 2014


This allows syslog to act as a fallback or a standalone logging destination.
Fixes FS#38584.

Signed-off-by: Zachary Cook <zachary.cook at 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



More information about the pacman-dev mailing list