This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=fffc2135af125ce6cdbde19501b401cce3e26761 commit fffc2135af125ce6cdbde19501b401cce3e26761 Author: Niels Thykier <[email protected]> AuthorDate: Wed Apr 22 15:38:46 2020 +0000 Use a conffilename variable to track the actual conffile name in the buffer [[email protected]: Refactored out from another commit. ] Signed-off-by: Niels Thykier <[email protected]> Signed-off-by: Guillem Jover <[email protected]> Changelog: internal --- dpkg-deb/build.c | 5 +++-- src/unpack.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index c8b4f74a7..31cd77379 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -252,7 +252,7 @@ check_conffiles(const char *ctrldir, const char *rootdir) { FILE *cf; struct varbuf controlfile = VARBUF_INIT; - char conffilename[MAXCONFFILENAME + 1]; + char conffilenamebuf[MAXCONFFILENAME + 1]; struct file_info *conffiles_head = NULL; struct file_info *conffiles_tail = NULL; @@ -268,8 +268,9 @@ check_conffiles(const char *ctrldir, const char *rootdir) ohshite(_("error opening conffiles file")); } - while (fgets(conffilename, MAXCONFFILENAME + 1, cf)) { + while (fgets(conffilenamebuf, MAXCONFFILENAME + 1, cf)) { struct stat controlstab; + char *conffilename = conffilenamebuf; int n; n = strlen(conffilename); diff --git a/src/unpack.c b/src/unpack.c index fcec93c98..4da17050f 100644 --- a/src/unpack.c +++ b/src/unpack.c @@ -342,23 +342,24 @@ deb_parse_conffiles(struct pkginfo *pkg, const char *control_conffiles, struct fsys_namenode *namenode; struct fsys_namenode_list *newconff; struct conffile *searchconff; + char *conffilename = conffilenamebuf; char *p; - p = conffilenamebuf + strlen(conffilenamebuf); - if (p == conffilenamebuf) + p = conffilename + strlen(conffilename); + if (p == conffilename) ohshit(_("conffile file contains an empty line")); if (p[-1] != '\n') ohshit(_("conffile name '%s' is too long, or missing final newline"), - conffilenamebuf); - p = str_rtrim_spaces(conffilenamebuf, p); - if (p == conffilenamebuf) + conffilename); + p = str_rtrim_spaces(conffilename, p); + if (p == conffilename) continue; - if (conffilenamebuf[0] != '/') + if (conffilename[0] != '/') ohshit(_("conffile name '%s' is not an absolute pathname"), - conffilenamebuf); + conffilename); - namenode = fsys_hash_find_node(conffilenamebuf, 0); + namenode = fsys_hash_find_node(conffilename, 0); namenode->oldhash = NEWCONFFILEFLAG; newconff = tar_fsys_namenode_queue_push(newconffiles, namenode); -- Dpkg.Org's dpkg

