diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/archives.c | 14 | ||||
-rw-r--r-- | src/configure.c | 2 | ||||
-rw-r--r-- | src/main.c | 19 | ||||
-rw-r--r-- | src/unpack.c | 1 |
4 files changed, 19 insertions, 17 deletions
diff --git a/src/archives.c b/src/archives.c index b8554d1a1..8f6b4cf81 100644 --- a/src/archives.c +++ b/src/archives.c @@ -390,7 +390,6 @@ tarobject_extract(struct tarcontext *tc, struct tar_entry *te, case TAR_FILETYPE_HARDLINK: varbuf_reset(&hardlinkfn); varbuf_add_str(&hardlinkfn, instdir); - varbuf_add_char(&hardlinkfn, '/'); linknode = findnamenode(te->linkname, 0); varbuf_add_str(&hardlinkfn, namenodetouse(linknode, tc->pkg, &tc->pkg->available)->name); @@ -832,7 +831,7 @@ tarobject(void *ctx, struct tar_entry *ti) st = &ti->stat; usenode = namenodetouse(nifd->namenode, tc->pkg, &tc->pkg->available); - usename = usenode->name + 1; /* Skip the leading '/'. */ + usename = usenode->name; trig_file_activate(usenode, tc->pkg); @@ -1196,16 +1195,14 @@ tar_writeback_barrier(struct fileinlist *files, struct pkginfo *pkg) for (cfile = files; cfile; cfile = cfile->next) { struct filenamenode *usenode; - const char *usename; int fd; if (!(cfile->namenode->flags & fnnf_deferred_fsync)) continue; usenode = namenodetouse(cfile->namenode, pkg, &pkg->available); - usename = usenode->name + 1; /* Skip the leading '/'. */ - setupfnamevbs(usename); + setupfnamevbs(usenode->name); fd = open(fnamenewvb.buf, O_WRONLY); if (fd < 0) @@ -1230,7 +1227,6 @@ tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg) { struct fileinlist *cfile; struct filenamenode *usenode; - const char *usename; tar_writeback_barrier(files, pkg); @@ -1241,9 +1237,8 @@ tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg) continue; usenode = namenodetouse(cfile->namenode, pkg, &pkg->available); - usename = usenode->name + 1; /* Skip the leading '/'. */ - setupfnamevbs(usename); + setupfnamevbs(usenode->name); if (cfile->namenode->flags & fnnf_deferred_fsync) { int fd; @@ -1646,11 +1641,8 @@ archivefiles(const char *const *argv) varbuf_reset(&fnamenewvb); varbuf_add_str(&fnamevb, instdir); - varbuf_add_char(&fnamevb, '/'); varbuf_add_str(&fnametmpvb, instdir); - varbuf_add_char(&fnametmpvb, '/'); varbuf_add_str(&fnamenewvb, instdir); - varbuf_add_char(&fnamenewvb, '/'); fnameidlu= fnamevb.used; ensure_diversions(); diff --git a/src/configure.c b/src/configure.c index 28094d8a0..304d4050a 100644 --- a/src/configure.c +++ b/src/configure.c @@ -716,8 +716,6 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) varbuf_reset(result); varbuf_add_str(result, instdir); - if (*in != '/') - varbuf_add_char(result, '/'); varbuf_add_str(result, in); varbuf_end_str(result); diff --git a/src/main.c b/src/main.c index 65c36268c..4ec4ecd06 100644 --- a/src/main.c +++ b/src/main.c @@ -46,6 +46,7 @@ #include <dpkg/dpkg.h> #include <dpkg/dpkg-db.h> #include <dpkg/arch.h> +#include <dpkg/path.h> #include <dpkg/subproc.h> #include <dpkg/command.h> #include <dpkg/options.h> @@ -344,11 +345,23 @@ set_verify_format(const struct cmdinfo *cip, const char *value) } static void +set_instdir(const struct cmdinfo *cip, const char *value) +{ + char *new_instdir; + + new_instdir = m_strdup(value); + path_trim_slash_slashdot(new_instdir); + + instdir = new_instdir; +} + +static void set_root(const struct cmdinfo *cip, const char *value) { char *p; - instdir= value; - m_asprintf(&p, "%s%s", value, ADMINDIR); + + set_instdir(cip, value); + m_asprintf(&p, "%s%s", instdir, ADMINDIR); admindir= p; } @@ -710,7 +723,7 @@ static const struct cmdinfo cmdinfos[]= { { "root", 0, 1, NULL, NULL, set_root, 0 }, { "abort-after", 0, 1, &errabort, NULL, set_integer, 0 }, { "admindir", 0, 1, NULL, &admindir, NULL, 0 }, - { "instdir", 0, 1, NULL, &instdir, NULL, 0 }, + { "instdir", 0, 1, NULL, NULL, set_instdir, 0 }, { "ignore-depends", 0, 1, NULL, NULL, set_ignore_depends, 0 }, { "force", 0, 2, NULL, NULL, set_force, 1 }, { "refuse", 0, 2, NULL, NULL, set_force, 0 }, diff --git a/src/unpack.c b/src/unpack.c index 85164eeb1..151a35e9e 100644 --- a/src/unpack.c +++ b/src/unpack.c @@ -1084,7 +1084,6 @@ void process_archive(const char *filename) { varbuf_reset(&cfilename); varbuf_add_str(&cfilename, instdir); - varbuf_add_char(&cfilename, '/'); varbuf_add_str(&cfilename, cfile->namenode->name); varbuf_end_str(&cfilename); |