diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:40:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:40:37 +0000 |
commit | cabd780cae125bed23f70d57db05ae0f32d8df4c (patch) | |
tree | aa0333438759b0295022ef95bd38df6b7226a89c /src/main/configure.c | |
parent | Releasing progress-linux version 1.22.4-0.0~progress7.99u1. (diff) | |
download | dpkg-cabd780cae125bed23f70d57db05ae0f32d8df4c.tar.xz dpkg-cabd780cae125bed23f70d57db05ae0f32d8df4c.zip |
Merging upstream version 1.22.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/main/configure.c')
-rw-r--r-- | src/main/configure.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/configure.c b/src/main/configure.c index c2d58c7..f2c9227 100644 --- a/src/main/configure.c +++ b/src/main/configure.c @@ -699,7 +699,6 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) { static struct varbuf target = VARBUF_INIT; struct stat stab; - ssize_t r; int loopprotect; varbuf_set_str(result, dpkg_fsys_get_dir()); @@ -724,6 +723,8 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) in, result->buf); return 0; } else if (S_ISLNK(stab.st_mode)) { + ssize_t linksize; + debug(dbg_conffdetail, "conffderef symlink loopprotect=%d", loopprotect); if (loopprotect++ >= 25) { @@ -734,36 +735,35 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) return -1; } - varbuf_reset(&target); - varbuf_grow(&target, stab.st_size + 1); - r = readlink(result->buf, target.buf, target.size); - if (r < 0) { + linksize = file_readlink(result->buf, &target, stab.st_size); + if (linksize < 0) { warning(_("%s: unable to readlink conffile '%s'\n" " (= '%s'): %s"), pkg_name(pkg, pnaw_nonambig), in, result->buf, strerror(errno)); return -1; - } else if (r != stab.st_size) { + } else if (linksize != stab.st_size) { warning(_("symbolic link '%.250s' size has " "changed from %jd to %zd"), - result->buf, (intmax_t)stab.st_size, r); + result->buf, (intmax_t)stab.st_size, + linksize); /* If the returned size is smaller, let's * proceed, otherwise error out. */ - if (r > stab.st_size) + if (linksize > stab.st_size) return -1; } - varbuf_trunc(&target, r); - varbuf_end_str(&target); debug(dbg_conffdetail, "conffderef readlink gave %zd, '%s'", - r, target.buf); + linksize, target.buf); if (target.buf[0] == '/') { varbuf_set_str(result, dpkg_fsys_get_dir()); debug(dbg_conffdetail, "conffderef readlink absolute"); } else { + ssize_t r; + for (r = result->used - 1; r > 0 && result->buf[r] != '/'; r--) ; if (r < 0) { |