Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 12:41:33 -0500
committerDan McGee <dan@archlinux.org>2011-06-09 14:24:45 -0500
commit7968d30510de5a6031af39da498be5c821290b82 (patch)
tree234c6c99ca5ce0efd5034c4eaedb9b89f1e81686 /lib/libalpm/util.c
parente826c143d3e9d21485f72c5490b2a907c936024e (diff)
Require handle argument to alpm_logaction()
This is the first in a series of patches to update the API to remove the implicit global handle variable. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index d24a51a6..68732d13 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -385,11 +385,11 @@ int _alpm_rmrf(const char *path)
return 0;
}
-int _alpm_logaction(int usesyslog, FILE *f, const char *fmt, va_list args)
+int _alpm_logaction(pmhandle_t *handle, const char *fmt, va_list args)
{
int ret = 0;
- if(usesyslog) {
+ if(handle->usesyslog) {
/* we can't use a va_list more than once, so we need to copy it
* so we can use the original when calling vfprintf below. */
va_list args_syslog;
@@ -398,7 +398,7 @@ int _alpm_logaction(int usesyslog, FILE *f, const char *fmt, va_list args)
va_end(args_syslog);
}
- if(f) {
+ if(handle->logstream) {
time_t t;
struct tm *tm;
@@ -406,11 +406,11 @@ int _alpm_logaction(int usesyslog, FILE *f, const char *fmt, va_list args)
tm = localtime(&t);
/* Use ISO-8601 date format */
- fprintf(f, "[%04d-%02d-%02d %02d:%02d] ",
+ fprintf(handle->logstream, "[%04d-%02d-%02d %02d:%02d] ",
tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
tm->tm_hour, tm->tm_min);
- ret = vfprintf(f, fmt, args);
- fflush(f);
+ ret = vfprintf(handle->logstream, fmt, args);
+ fflush(handle->logstream);
}
return ret;
@@ -496,7 +496,7 @@ int _alpm_run_chroot(pmhandle_t *handle, const char *path, char *const argv[])
char line[PATH_MAX];
if(fgets(line, PATH_MAX, pipe) == NULL)
break;
- alpm_logaction("%s", line);
+ alpm_logaction(handle, "%s", line);
EVENT(handle->trans, PM_TRANS_EVT_SCRIPTLET_INFO, line, NULL);
}
fclose(pipe);