summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dselect/main.cc6
-rw-r--r--lib/dpkg/dbmodify.c10
-rw-r--r--lib/dpkg/dpkg-db.h4
-rw-r--r--lib/dpkg/trigdeferred.h3
-rw-r--r--lib/dpkg/trigdeferred.l2
-rw-r--r--lib/dpkg/triglib.c6
-rw-r--r--lib/dpkg/triglib.h2
-rw-r--r--src/archives.c3
-rw-r--r--src/enquiry.c8
-rw-r--r--src/help.c4
-rw-r--r--src/packages.c3
-rw-r--r--src/querycmd.c16
-rw-r--r--src/select.c6
-rw-r--r--src/trigcmd.c4
-rw-r--r--src/update.c2
15 files changed, 38 insertions, 41 deletions
diff --git a/dselect/main.cc b/dselect/main.cc
index ad2d46809..f6cbf131e 100644
--- a/dselect/main.cc
+++ b/dselect/main.cc
@@ -360,8 +360,8 @@ extern void operator delete(void *p) {
}
urqresult urq_list(void) {
- readwrite = modstatdb_open(admindir, (modstatdb_rw)(msdbrw_writeifposs |
- msdbrw_available_readonly));
+ readwrite = modstatdb_open((modstatdb_rw)(msdbrw_writeifposs |
+ msdbrw_available_readonly));
curseson();
@@ -423,7 +423,7 @@ refreshmenu(void)
sprintf(buf, gettext(licensestring), DSELECT);
addstr(buf);
- modstatdb_init(admindir);
+ modstatdb_init();
if (!modstatdb_can_lock())
addstr(_("\n\n"
"Read-only access: only preview of selections is available!"));
diff --git a/lib/dpkg/dbmodify.c b/lib/dpkg/dbmodify.c
index 453711f8e..60cad77ed 100644
--- a/lib/dpkg/dbmodify.c
+++ b/lib/dpkg/dbmodify.c
@@ -147,7 +147,7 @@ static const struct fni {
};
void
-modstatdb_init(const char *admindir)
+modstatdb_init(void)
{
const struct fni *fnip;
@@ -245,9 +245,9 @@ modstatdb_unlock(void)
}
enum modstatdb_rw
-modstatdb_open(const char *admindir, enum modstatdb_rw readwritereq)
+modstatdb_open(enum modstatdb_rw readwritereq)
{
- modstatdb_init(admindir);
+ modstatdb_init();
cflags = readwritereq & msdbrw_available_mask;
readwritereq &= ~msdbrw_available_mask;
@@ -259,7 +259,7 @@ modstatdb_open(const char *admindir, enum modstatdb_rw readwritereq)
ohshit(_("requested operation requires superuser privilege"));
/* Fall through. */
case msdbrw_write: case msdbrw_writeifposs:
- if (access(admindir, W_OK)) {
+ if (access(dpkg_db_get_dir(), W_OK)) {
if (errno != EACCES)
ohshite(_("unable to access dpkg status area"));
else if (readwritereq == msdbrw_write)
@@ -292,7 +292,7 @@ modstatdb_open(const char *admindir, enum modstatdb_rw readwritereq)
}
trig_fixup_awaiters(cstatus);
- trig_incorporate(cstatus, admindir);
+ trig_incorporate(cstatus);
return cstatus;
}
diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h
index 8db647d8f..d9602b956 100644
--- a/lib/dpkg/dpkg-db.h
+++ b/lib/dpkg/dpkg-db.h
@@ -228,13 +228,13 @@ enum modstatdb_rw {
msdbrw_available_write = 0200,
};
-void modstatdb_init(const char *admindir);
+void modstatdb_init(void);
void modstatdb_done(void);
bool modstatdb_is_locked(void);
bool modstatdb_can_lock(void);
void modstatdb_lock(void);
void modstatdb_unlock(void);
-enum modstatdb_rw modstatdb_open(const char *admindir, enum modstatdb_rw reqrwflags);
+enum modstatdb_rw modstatdb_open(enum modstatdb_rw reqrwflags);
void modstatdb_note(struct pkginfo *pkg);
void modstatdb_note_ifwrite(struct pkginfo *pkg);
void modstatdb_checkpoint(void);
diff --git a/lib/dpkg/trigdeferred.h b/lib/dpkg/trigdeferred.h
index 2d4dcc8cf..1ac30b0f3 100644
--- a/lib/dpkg/trigdeferred.h
+++ b/lib/dpkg/trigdeferred.h
@@ -51,8 +51,7 @@ struct trigdefmeths {
void trigdef_set_methods(const struct trigdefmeths *methods);
-enum trigdef_update_status trigdef_update_start(enum trigdef_updateflags uf,
- const char *admindir);
+enum trigdef_update_status trigdef_update_start(enum trigdef_updateflags uf);
void trigdef_update_printf(const char *format, ...) DPKG_ATTR_PRINTF(1);
int trigdef_parse(void);
void trigdef_process_done(void);
diff --git a/lib/dpkg/trigdeferred.l b/lib/dpkg/trigdeferred.l
index 638f087b4..a8737fb06 100644
--- a/lib/dpkg/trigdeferred.l
+++ b/lib/dpkg/trigdeferred.l
@@ -117,7 +117,7 @@ constructfn(struct varbuf *vb, const char *dir, const char *tail)
* For positive return values the caller must call trigdef_update_done!
*/
enum trigdef_update_status
-trigdef_update_start(enum trigdef_updateflags uf, const char *admindir)
+trigdef_update_start(enum trigdef_updateflags uf)
{
struct stat stab;
int r;
diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index 758e94436..e4ba6318e 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -769,7 +769,7 @@ static const struct trigdefmeths tdm_incorp = {
};
void
-trig_incorporate(enum modstatdb_rw cstatus, const char *admindir)
+trig_incorporate(enum modstatdb_rw cstatus)
{
enum trigdef_update_status ur;
enum trigdef_updateflags tduf;
@@ -793,7 +793,7 @@ trig_incorporate(enum modstatdb_rw cstatus, const char *admindir)
tduf |= tduf_writeifenoent;
}
- ur = trigdef_update_start(tduf, admindir);
+ ur = trigdef_update_start(tduf);
if (ur == tdus_error_no_dir && cstatus >= msdbrw_write) {
if (mkdir(triggersdir, 0755)) {
if (errno != EEXIST)
@@ -803,7 +803,7 @@ trig_incorporate(enum modstatdb_rw cstatus, const char *admindir)
ohshite(_("unable to set ownership of triggers state"
" directory `%.250s'"), triggersdir);
}
- ur = trigdef_update_start(tduf, admindir);
+ ur = trigdef_update_start(tduf);
}
switch (ur) {
case tdus_error_empty_deferred:
diff --git a/lib/dpkg/triglib.h b/lib/dpkg/triglib.h
index 1f92137f1..9c06ac3c1 100644
--- a/lib/dpkg/triglib.h
+++ b/lib/dpkg/triglib.h
@@ -90,7 +90,7 @@ void trig_cicb_statuschange_activate(const char *trig, void *user);
void trig_parse_ci(const char *file, trig_parse_cicb *interest,
trig_parse_cicb *activate, void *user);
-void trig_incorporate(enum modstatdb_rw cstatus, const char *admindir);
+void trig_incorporate(enum modstatdb_rw cstatus);
DPKG_END_DECLS
diff --git a/src/archives.c b/src/archives.c
index 31ebdb7a7..2d0a1bd99 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -1181,8 +1181,7 @@ void archivefiles(const char *const *argv) {
trigproc_install_hooks();
- modstatdb_open(admindir,
- f_noact ? msdbrw_readonly :
+ modstatdb_open(f_noact ? msdbrw_readonly :
(cipaction->arg_int == act_avail ? msdbrw_readonly :
fc_nonroot ? msdbrw_write :
msdbrw_needsuperuser) |
diff --git a/src/enquiry.c b/src/enquiry.c
index 38593ae85..079da59ee 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -134,7 +134,7 @@ void audit(const char *const *argv) {
if (*argv)
badusage(_("--%s takes no arguments"), cipaction->olong);
- modstatdb_open(admindir, msdbrw_readonly);
+ modstatdb_open(msdbrw_readonly);
for (bsi= badstatinfos; bsi->yesno; bsi++) {
struct pkgiterator *it;
@@ -204,7 +204,7 @@ void unpackchk(const char *const *argv) {
if (*argv)
badusage(_("--%s takes no arguments"), cipaction->olong);
- modstatdb_open(admindir, msdbrw_readonly);
+ modstatdb_open(msdbrw_readonly);
totalcount= 0;
sectionentries = NULL;
@@ -282,7 +282,7 @@ assert_version_support(const char *const *argv,
if (*argv)
badusage(_("--%s takes no arguments"), cipaction->olong);
- modstatdb_open(admindir, msdbrw_readonly);
+ modstatdb_open(msdbrw_readonly);
pkg = pkg_db_find("dpkg");
switch (pkg->status) {
@@ -348,7 +348,7 @@ void predeppackage(const char *const *argv) {
if (*argv)
badusage(_("--%s takes no arguments"), cipaction->olong);
- modstatdb_open(admindir, msdbrw_readonly | msdbrw_available_readonly);
+ modstatdb_open(msdbrw_readonly | msdbrw_available_readonly);
/* We use clientdata->istobe to detect loops. */
clear_istobes();
diff --git a/src/help.c b/src/help.c
index 9bbe3beae..ccbb704b0 100644
--- a/src/help.c
+++ b/src/help.c
@@ -226,7 +226,7 @@ post_postinst_tasks_core(struct pkginfo *pkg)
if (!f_noact) {
debug(dbg_triggersdetail, "post_postinst_tasks_core - trig_incorporate");
- trig_incorporate(msdbrw_write, admindir);
+ trig_incorporate(msdbrw_write);
}
}
@@ -237,7 +237,7 @@ post_script_tasks(void)
debug(dbg_triggersdetail,
"post_script_tasks - ensure_diversions; trig_incorporate");
- trig_incorporate(msdbrw_write, admindir);
+ trig_incorporate(msdbrw_write);
}
static void
diff --git a/src/packages.c b/src/packages.c
index 8345627cf..82f05ce31 100644
--- a/src/packages.c
+++ b/src/packages.c
@@ -122,8 +122,7 @@ packages(const char *const *argv)
{
trigproc_install_hooks();
- modstatdb_open(admindir,
- f_noact ? msdbrw_readonly :
+ modstatdb_open(f_noact ? msdbrw_readonly :
fc_nonroot ? msdbrw_write :
msdbrw_needsuperuser);
checkpath();
diff --git a/src/querycmd.c b/src/querycmd.c
index ef4692d23..0f0912291 100644
--- a/src/querycmd.c
+++ b/src/querycmd.c
@@ -202,9 +202,9 @@ listpackages(const char *const *argv)
struct list_format fmt;
if (!*argv)
- modstatdb_open(admindir, msdbrw_readonly);
+ modstatdb_open(msdbrw_readonly);
else
- modstatdb_open(admindir, msdbrw_readonly | msdbrw_available_readonly);
+ modstatdb_open(msdbrw_readonly | msdbrw_available_readonly);
pkg_array_init_from_db(&array);
pkg_array_sort(&array, pkg_sorter_by_name);
@@ -305,7 +305,7 @@ searchfiles(const char *const *argv)
if (!*argv)
badusage(_("--search needs at least one file name pattern argument"));
- modstatdb_open(admindir, msdbrw_readonly);
+ modstatdb_open(msdbrw_readonly);
ensure_allinstfiles_available_quiet();
ensure_diversions();
@@ -372,9 +372,9 @@ enqperpackage(const char *const *argv)
badusage(_("--%s needs at least one package name argument"), cipaction->olong);
if (cipaction->arg_int == act_printavail)
- modstatdb_open(admindir, msdbrw_readonly | msdbrw_available_readonly);
+ modstatdb_open(msdbrw_readonly | msdbrw_available_readonly);
else
- modstatdb_open(admindir, msdbrw_readonly);
+ modstatdb_open(msdbrw_readonly);
while ((thisarg = *argv++) != NULL) {
pkg = pkg_db_find(thisarg);
@@ -470,9 +470,9 @@ showpackages(const char *const *argv)
}
if (!*argv)
- modstatdb_open(admindir, msdbrw_readonly);
+ modstatdb_open(msdbrw_readonly);
else
- modstatdb_open(admindir, msdbrw_readonly | msdbrw_available_readonly);
+ modstatdb_open(msdbrw_readonly | msdbrw_available_readonly);
pkg_array_init_from_db(&array);
pkg_array_sort(&array, pkg_sorter_by_name);
@@ -575,7 +575,7 @@ control_path(const char *const *argv)
badusage(_("control file contains %c"), *c);
}
- modstatdb_open(admindir, msdbrw_readonly);
+ modstatdb_open(msdbrw_readonly);
pkg = pkg_db_find(pkg_name);
if (pkg->status == stat_notinstalled)
diff --git a/src/select.c b/src/select.c
index 59b9bc4cd..95349f023 100644
--- a/src/select.c
+++ b/src/select.c
@@ -50,7 +50,7 @@ void getselections(const char *const *argv) {
const char *thisarg;
int i, found;
- modstatdb_open(admindir, msdbrw_readonly);
+ modstatdb_open(msdbrw_readonly);
pkg_array_init_from_db(&array);
pkg_array_sort(&array, pkg_sorter_by_name);
@@ -91,7 +91,7 @@ void setselections(const char *const *argv) {
if (*argv)
badusage(_("--%s takes no arguments"), cipaction->olong);
- modstatdb_open(admindir, msdbrw_write | msdbrw_available_readonly);
+ modstatdb_open(msdbrw_write | msdbrw_available_readonly);
lno= 1;
for (;;) {
@@ -154,7 +154,7 @@ void clearselections(const char *const *argv)
if (*argv)
badusage(_("--%s takes no arguments"), cipaction->olong);
- modstatdb_open(admindir, msdbrw_write);
+ modstatdb_open(msdbrw_write);
it = pkg_db_iter_new();
while ((pkg = pkg_db_iter_next(it))) {
diff --git a/src/trigcmd.c b/src/trigcmd.c
index b7fa396a5..a37f882f9 100644
--- a/src/trigcmd.c
+++ b/src/trigcmd.c
@@ -148,7 +148,7 @@ do_check(void)
{
enum trigdef_update_status uf;
- uf = trigdef_update_start(tduf_nolockok, admindir);
+ uf = trigdef_update_start(tduf_nolockok);
switch (uf) {
case tdus_error_no_dir:
fprintf(stderr, _("%s: triggers data directory not yet created\n"),
@@ -227,7 +227,7 @@ main(int argc, const char *const *argv)
tduf = tduf_nolockok;
if (!f_noact)
tduf |= tduf_write | tduf_writeifempty;
- uf = trigdef_update_start(tduf, admindir);
+ uf = trigdef_update_start(tduf);
if (uf >= 0) {
trigdef_parse();
if (!done_trig)
diff --git a/src/update.c b/src/update.c
index e4125567b..931979a27 100644
--- a/src/update.c
+++ b/src/update.c
@@ -39,7 +39,7 @@ void updateavailable(const char *const *argv) {
char *availfile;
int count= 0;
- modstatdb_init(admindir);
+ modstatdb_init();
switch (cipaction->arg_int) {
case act_avclear: