mirror of
https://github.com/moparisthebest/pacman
synced 2025-03-01 01:41:52 -05:00
alpm_logaction: check logfile before opening
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@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
ae7067440c
commit
e4af5e3c97
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user