diff options
author | Guillem Jover <guillem@debian.org> | 2011-03-13 19:56:01 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2011-03-14 07:21:56 +0100 |
commit | dcac09fadeaea420267c85d430ed7668f3e37ba7 (patch) | |
tree | aab6e7e1b7408a610ca6d8eaa9c92f3eb956ffd3 | |
parent | e0ae796d8cde360c5bf9b46b49998f6efa3b8c82 (diff) | |
download | dpkg-dcac09fadeaea420267c85d430ed7668f3e37ba7.tar.gz |
Make admindir file local everywhere
The interface to get and set the database directory is dpkg_db_get_dir()
and dpkg_db_set_dir().
-rw-r--r-- | dselect/dselect.h | 1 | ||||
-rw-r--r-- | dselect/main.cc | 3 | ||||
-rw-r--r-- | dselect/method.cc | 10 | ||||
-rw-r--r-- | src/divertcmd.c | 2 | ||||
-rw-r--r-- | src/help.c | 1 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/main.h | 1 | ||||
-rw-r--r-- | src/processarc.c | 2 | ||||
-rw-r--r-- | src/querycmd.c | 2 | ||||
-rw-r--r-- | src/statcmd.c | 4 | ||||
-rw-r--r-- | src/update.c | 2 |
11 files changed, 16 insertions, 14 deletions
diff --git a/dselect/dselect.h b/dselect/dselect.h index 6667d6563..1d05e4430 100644 --- a/dselect/dselect.h +++ b/dselect/dselect.h @@ -148,7 +148,6 @@ void mywerase(WINDOW *win); void curseson(); void cursesoff(); -extern const char *admindir; extern int expertmode; enum screenparts { diff --git a/dselect/main.cc b/dselect/main.cc index f6cbf131e..c62646370 100644 --- a/dselect/main.cc +++ b/dselect/main.cc @@ -61,9 +61,10 @@ const char thisname[]= DSELECT; const char printforhelp[]= N_("Type dselect --help for help."); modstatdb_rw readwrite; -const char *admindir= ADMINDIR; int expertmode= 0; +static const char *admindir = ADMINDIR; + static keybindings packagelistbindings(packagelist_kinterps,packagelist_korgbindings); struct table_t { diff --git a/dselect/method.cc b/dselect/method.cc index bfff741b4..82488ced2 100644 --- a/dselect/method.cc +++ b/dselect/method.cc @@ -179,8 +179,8 @@ static urqresult runscript(const char *exepath, const char *name) { strcpy(coption->meth->pathinmeth,exepath); command_init(&cmd, coption->meth->path, name); - command_add_args(&cmd, exepath, admindir, coption->meth->name, - coption->name, NULL); + command_add_args(&cmd, exepath, dpkg_db_get_dir(), + coption->meth->name, coption->name, NULL); ur = falliblesubprocess(&cmd); command_destroy(&cmd); } else { @@ -205,7 +205,7 @@ static urqresult rundpkgauto(const char *name, const char *dpkgmode) { struct command cmd; command_init(&cmd, DPKG, name); - command_add_args(&cmd, DPKG, "--admindir", admindir, "--pending", + command_add_args(&cmd, DPKG, "--admindir", dpkg_db_get_dir(), "--pending", dpkgmode, NULL); cursesoff(); @@ -244,8 +244,8 @@ urqresult urq_setup(void) { strcpy(coption->meth->pathinmeth,METHODSETUPSCRIPT); command_init(&cmd, coption->meth->path, _("query/setup script")); - command_add_args(&cmd, METHODSETUPSCRIPT, admindir, coption->meth->name, - coption->name, NULL); + command_add_args(&cmd, METHODSETUPSCRIPT, dpkg_db_get_dir(), + coption->meth->name, coption->name, NULL); ur = falliblesubprocess(&cmd); command_destroy(&cmd); if (ur == urqr_normal) writecurrentopt(); diff --git a/src/divertcmd.c b/src/divertcmd.c index 0c0d21383..35753402a 100644 --- a/src/divertcmd.c +++ b/src/divertcmd.c @@ -49,7 +49,7 @@ const char thisname[] = "dpkg-divert"; const char printforhelp[] = N_("Use --help for help about querying packages."); -const char *admindir; +static const char *admindir; static bool opt_pkgname_match_any = true; static const char *opt_pkgname = NULL; diff --git a/src/help.c b/src/help.c index ccbb704b0..1be86e69d 100644 --- a/src/help.c +++ b/src/help.c @@ -180,6 +180,7 @@ force_conflicts(struct deppossi *possi) static const char * preexecscript(struct command *cmd) { + const char *admindir = dpkg_db_get_dir(); size_t instdirl = strlen(instdir); if (*instdir) { diff --git a/src/main.c b/src/main.c index cfa0e7a72..94fea3572 100644 --- a/src/main.c +++ b/src/main.c @@ -189,7 +189,7 @@ int fc_unsafe_io = 0; int fc_badverify = 0; int errabort = 50; -const char *admindir= ADMINDIR; +static const char *admindir = ADMINDIR; const char *instdir= ""; struct pkg_list *ignoredependss = NULL; diff --git a/src/main.h b/src/main.h index 463ad990a..fcebdac12 100644 --- a/src/main.h +++ b/src/main.h @@ -136,7 +136,6 @@ extern int fc_unsafe_io; extern bool abort_processing; extern int errabort; -extern const char *admindir; extern const char *instdir; extern struct pkg_list *ignoredependss; extern const char native_arch[]; diff --git a/src/processarc.c b/src/processarc.c index 06526af18..555d97c61 100644 --- a/src/processarc.c +++ b/src/processarc.c @@ -383,6 +383,8 @@ void process_archive(const char *filename) { free(tmpdir); } else { + const char *admindir = dpkg_db_get_dir(); + /* We want it to be on the same filesystem so that we can * use rename(2) to install the postinst &c. */ if (!cidir) diff --git a/src/querycmd.c b/src/querycmd.c index 0f0912291..ff230229c 100644 --- a/src/querycmd.c +++ b/src/querycmd.c @@ -652,7 +652,7 @@ usage(const struct cmdinfo *ci, const char *value) const char thisname[]= "dpkg-query"; const char printforhelp[]= N_("Use --help for help about querying packages."); -const char *admindir; +static const char *admindir; /* This table has both the action entries in it and the normal options. * The action entries are made with the ACTION macro, as they all diff --git a/src/statcmd.c b/src/statcmd.c index 02933a9c9..d33e100c6 100644 --- a/src/statcmd.c +++ b/src/statcmd.c @@ -99,7 +99,7 @@ usage(const struct cmdinfo *cip, const char *value) exit(0); } -const char *admindir; +static const char *admindir; static int opt_verbose = 1; static int opt_force = 0; @@ -224,7 +224,7 @@ statdb_write(void) if (rename(dbname_new, dbname)) ohshite(_("error installing new statoverride")); - dir_sync_path(admindir); + dir_sync_path(dpkg_db_get_dir()); free(dbname); free(dbname_new); diff --git a/src/update.c b/src/update.c index 931979a27..668906443 100644 --- a/src/update.c +++ b/src/update.c @@ -54,7 +54,7 @@ void updateavailable(const char *const *argv) { } if (!f_noact) { - if (access(admindir,W_OK)) { + if (access(dpkg_db_get_dir(), W_OK)) { if (errno != EACCES) ohshite(_("unable to access dpkg status area for bulk available update")); else |