From 1480ac29e475e369fb781fe98ac5991e1a67e5e5 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 9 Jul 2007 15:22:01 -0400 Subject: Clean up the alpm handle Add some comments in handle.h, and remove the pmaccess_t part that we don't even use. Signed-off-by: Dan McGee --- lib/libalpm/handle.c | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) (limited to 'lib/libalpm/handle.c') diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 7cee5020..b1fd45f2 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -53,31 +53,10 @@ pmhandle_t *_alpm_handle_new() memset(handle, 0, sizeof(pmhandle_t)); handle->lckfd = -1; + handle->logstream = NULL; -#ifndef CYGWIN /* see if we're root or not */ handle->uid = geteuid(); -//#ifndef FAKEROOT -// if(!handle->uid && getenv("FAKEROOTKEY")) { -// /* fakeroot doesn't count, we're non-root */ -// handle->uid = 99; -// } -//#endif -// -// /* see if we're root or not (fakeroot does not count) */ -//#ifndef FAKEROOT -// if(handle->uid == 0 && !getenv("FAKEROOTKEY")) { -// /* } make vim indent work - stupid ifdef's */ -//#else -// if(handle->uid == 0) { -//#endif -// handle->access = PM_ACCESS_RW; -// } else { -// handle->access = PM_ACCESS_RO; -// } -//#else - handle->access = PM_ACCESS_RW; -#endif handle->root = NULL; handle->dbpath = NULL; handle->cachedirs = NULL; @@ -95,10 +74,10 @@ void _alpm_handle_free(pmhandle_t *handle) return; } - /* close logfiles */ - if(handle->logfd) { - fclose(handle->logfd); - handle->logfd = NULL; + /* close logfile */ + if(handle->logstream) { + fclose(handle->logstream); + handle->logstream= NULL; } if(handle->usesyslog) { handle->usesyslog = 0; @@ -231,14 +210,14 @@ void SYMEXPORT alpm_option_set_logfile(const char *logfile) if(handle->logfile) { FREE(handle->logfile); - if(handle->logfd) { - fclose(handle->logfd); - handle->logfd = NULL; + if(handle->logstream) { + fclose(handle->logstream); + handle->logstream = NULL; } } if(logfile) { handle->logfile = strdup(logfile); - handle->logfd = fopen(logfile, "a"); + handle->logstream = fopen(logfile, "a"); } } -- cgit v1.2.3-24-g4f1b