Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/log.c')
-rw-r--r--lib/libalpm/log.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c
index 9093af7b..91bcb823 100644
--- a/lib/libalpm/log.c
+++ b/lib/libalpm/log.c
@@ -36,18 +36,16 @@
*/
/** A printf-like function for logging.
+ * @param handle the context handle
* @param fmt output format
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int SYMEXPORT alpm_logaction(const char *fmt, ...)
+int SYMEXPORT alpm_logaction(pmhandle_t *handle, const char *fmt, ...)
{
int ret;
va_list args;
- ALPM_LOG_FUNC;
-
- /* Sanity checks */
- ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
+ ASSERT(handle != NULL, return -1);
/* check if the logstream is open already, opening it if needed */
if(handle->logstream == NULL) {
@@ -55,18 +53,18 @@ int SYMEXPORT alpm_logaction(const char *fmt, ...)
/* if we couldn't open it, we have an issue */
if(handle->logstream == NULL) {
if(errno == EACCES) {
- pm_errno = PM_ERR_BADPERMS;
+ handle->pm_errno = PM_ERR_BADPERMS;
} else if(errno == ENOENT) {
- pm_errno = PM_ERR_NOT_A_DIR;
+ handle->pm_errno = PM_ERR_NOT_A_DIR;
} else {
- pm_errno = PM_ERR_SYSTEM;
+ handle->pm_errno = PM_ERR_SYSTEM;
}
- return -1;
+ return -1;
}
}
va_start(args, fmt);
- ret = _alpm_logaction(handle->usesyslog, handle->logstream, fmt, args);
+ ret = _alpm_logaction(handle, fmt, args);
va_end(args);
/* TODO We should add a prefix to log strings depending on who called us.
@@ -85,10 +83,10 @@ int SYMEXPORT alpm_logaction(const char *fmt, ...)
/** @} */
-void _alpm_log(pmloglevel_t flag, const char *fmt, ...)
+void _alpm_log(pmhandle_t *handle, pmloglevel_t flag, const char *fmt, ...)
{
va_list args;
- alpm_cb_log logcb = alpm_option_get_logcb();
+ alpm_cb_log logcb = alpm_option_get_logcb(handle);
if(logcb == NULL) {
return;