[pacman-dev] [PATCH 2/4] alpm_logaction: check logfile before opening
Andrew Gregory
andrew.gregory.8 at gmail.com
Sun Apr 12 04:01:21 UTC 2015
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 <andrew.gregory.8 at gmail.com>
---
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
More information about the pacman-dev
mailing list