valgrind does not like calling open(NULL, ...).  This also makes the
return value 0 if logfile has not been set.

Signed-off-by: Andrew Gregory <[email protected]>
---
 lib/libalpm/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c
index fceb96f..c049bf9 100644
--- a/lib/libalpm/log.c
+++ b/lib/libalpm/log.c
@@ -53,7 +53,7 @@ int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const 
char *prefix,
        }
 
        /* check if the logstream is open already, opening it if needed */
-       if(handle->logstream == NULL) {
+       if(handle->logstream == NULL && handle->logfile != NULL) {
                int fd;
                do {
                        fd = open(handle->logfile, O_WRONLY | O_APPEND | 
O_CREAT | O_CLOEXEC,
-- 
2.3.5

Reply via email to