This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=3dae1ce0da98fae368b268cb0ebb92d3570af02a commit 3dae1ce0da98fae368b268cb0ebb92d3570af02a Author: Guillem Jover <[email protected]> AuthorDate: Sat Nov 26 04:07:23 2022 +0100 src: Avoid using instdir directly except for initialization Whenever we are not initializing the instdir variable prefer to get it from dpkg_fsys_get_dir() so that we can then easily remove the variable entirely and rely on the fsys module tracking the contents for us. --- src/divert/main.c | 2 +- src/main/main.c | 4 ++-- src/statoverride/main.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/divert/main.c b/src/divert/main.c index f4d8502d3..baaa2758a 100644 --- a/src/divert/main.c +++ b/src/divert/main.c @@ -147,7 +147,7 @@ file_init(struct file *f, const char *filename) { struct varbuf usefilename = VARBUF_INIT; - varbuf_add_str(&usefilename, instdir); + varbuf_add_str(&usefilename, dpkg_fsys_get_dir()); varbuf_add_str(&usefilename, filename); varbuf_end_str(&usefilename); diff --git a/src/main/main.c b/src/main/main.c index 8bf3b19fc..f25763054 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -763,9 +763,9 @@ int main(int argc, const char *const *argv) { admindir = dpkg_db_set_dir(admindir); /* Always set environment, to avoid possible security risks. */ - if (setenv("DPKG_ADMINDIR", admindir, 1) < 0) + if (setenv("DPKG_ADMINDIR", dpkg_db_get_dir(), 1) < 0) ohshite(_("unable to setenv for subprocesses")); - if (setenv("DPKG_ROOT", instdir, 1) < 0) + if (setenv("DPKG_ROOT", dpkg_fsys_get_dir(), 1) < 0) ohshite(_("unable to setenv for subprocesses")); force_string = get_force_string(); if (setenv("DPKG_FORCE", force_string, 1) < 0) diff --git a/src/statoverride/main.c b/src/statoverride/main.c index cfdc1dab2..ddb8d75ff 100644 --- a/src/statoverride/main.c +++ b/src/statoverride/main.c @@ -293,7 +293,7 @@ statoverride_add(const char *const *argv) struct stat st; struct varbuf realfilename = VARBUF_INIT; - varbuf_add_str(&realfilename, instdir); + varbuf_add_str(&realfilename, dpkg_fsys_get_dir()); varbuf_add_str(&realfilename, filename); varbuf_end_str(&realfilename); -- Dpkg.Org's dpkg

