summaryrefslogtreecommitdiff
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-06-27 23:25:04 -0400
committerDan McGee <dan@archlinux.org>2007-06-27 23:34:38 -0400
commit7daa6708d2afc710bebbb2dc30f4371f9d67120c (patch)
tree2321ad0d697ce56b4cad0e16222b3888cd31ac2f /lib/libalpm/handle.c
parent7bdb904af5b664c1d6e47977f21f0e6bc3f8e3b0 (diff)
downloadpacman-7daa6708d2afc710bebbb2dc30f4371f9d67120c.tar.xz
Remove lockfile configuration from frontend, make it job of libalpm
I previously introduced some patches to make just about every path in pacman/libalpm configurable; doing this with the lockfile seemed a bit too far and we really should just place the lockfile where it belongs- with the DB that needs locking. More details in this thread: http://archlinux.org/pipermail/pacman-dev/2007-June/008499.html Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 6f9e3330..7cee5020 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -181,6 +181,7 @@ void SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
ALPM_LOG_FUNC;
if(handle->dbpath) FREE(handle->dbpath);
+ if(handle->lockfile) FREE(handle->lockfile);
if(dbpath) {
/* verify dbpath ends in a '/' */
int dbpathlen = strlen(dbpath);
@@ -190,7 +191,13 @@ void SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
handle->dbpath = calloc(dbpathlen+1, sizeof(char));
strncpy(handle->dbpath, dbpath, dbpathlen);
handle->dbpath[dbpathlen-1] = '/';
+
+ const char *lf = "db.lck";
+ int lockfilelen = strlen(handle->dbpath) + strlen(lf);
+ handle->lockfile = calloc(lockfilelen + 1, sizeof(char));
+ snprintf(handle->lockfile, lockfilelen, "%s%s", handle->dbpath, lf);
}
+
}
void SYMEXPORT alpm_option_add_cachedir(const char *cachedir)
@@ -235,16 +242,6 @@ void SYMEXPORT alpm_option_set_logfile(const char *logfile)
}
}
-void SYMEXPORT alpm_option_set_lockfile(const char *lockfile)
-{
- ALPM_LOG_FUNC;
-
- if(handle->lockfile) FREE(handle->lockfile);
- if(lockfile) {
- handle->lockfile = strdup(lockfile);
- }
-}
-
void SYMEXPORT alpm_option_set_usesyslog(unsigned short usesyslog)
{
handle->usesyslog = usesyslog;