index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2014-01-02 12:37:12 -0600 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-01-06 14:38:50 +1000 |
commit | 086bbc5b623d08df9ffe595bd5ee965e668a4ae1 (patch) | |
tree | 894ba4ccad5f33bb497329c1c75a8200b9109b09 /lib/libalpm/log.c | |
parent | 8bec8a3f6a09155827aa8c3287f6d814c6912717 (diff) |
-rw-r--r-- | lib/libalpm/log.c | 11 |
diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c index 2cdf7403..c4a9d84c 100644 --- a/lib/libalpm/log.c +++ b/lib/libalpm/log.c @@ -49,9 +49,16 @@ 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) { - handle->logstream = fopen(handle->logfile, "a"); + int fd; + do { + fd = open(handle->logfile, O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, + 0000); + } while(fd == -1 && errno == EINTR); + if(fd >= 0) { + handle->logstream = fdopen(fd, "a"); + } /* if we couldn't open it, we have an issue */ - if(handle->logstream == NULL) { + if(fd < 0 || handle->logstream == NULL) { if(errno == EACCES) { handle->pm_errno = ALPM_ERR_BADPERMS; } else if(errno == ENOENT) { |