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=1a7b7d52ef6e637718bccdefc78bb1437b9af27e commit 1a7b7d52ef6e637718bccdefc78bb1437b9af27e Author: Guillem Jover <[email protected]> AuthorDate: Wed Jul 10 22:36:18 2024 +0200 dpkg: Check for < 0 instead of == -1 for conffderef() return values This is a dpkg specific function that returns 0 on success and -1 on error. While a static analyzer should have enough in-tree information to be able to avoid emitting bogus diagnostics, we switch to the same pattern as we just did for syscall return values so that the coding style is uniform. While at it we improve the debug output for the newly handled values. Changelog: internal --- src/main/configure.c | 2 +- src/main/remove.c | 10 +++++++--- src/main/unpack.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/configure.c b/src/main/configure.c index fd760a95c..889db1183 100644 --- a/src/main/configure.c +++ b/src/main/configure.c @@ -389,7 +389,7 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff) pkg, &pkg->installed); rc = conffderef(pkg, &cdr, usenode->name); - if (rc == -1) { + if (rc < 0) { conff->hash = EMPTYHASHFLAG; return; } diff --git a/src/main/remove.c b/src/main/remove.c index 56514bdd6..f36d7f98e 100644 --- a/src/main/remove.c +++ b/src/main/remove.c @@ -534,10 +534,14 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { } varbuf_reset(&fnvb); rc = conffderef(pkg, &fnvb, conff->name); - debug(dbg_conffdetail, "removal_bulk conffile '%s' (= '%s')", - conff->name, rc == -1 ? "<rc == -1>" : fnvb.buf); - if (rc == -1) + if (rc < 0) { + debug(dbg_conffdetail, "removal_bulk conffile '%s' (rc < %d)", + conff->name, rc); continue; + } else { + debug(dbg_conffdetail, "removal_bulk conffile '%s' (deref '%s')", + conff->name, fnvb.buf); + } namenode = fsys_hash_find_node(conff->name, FHFF_NONE); usenode = namenodetouse(namenode, pkg, &pkg->installed); diff --git a/src/main/unpack.c b/src/main/unpack.c index 18f25e091..e57a6e35e 100644 --- a/src/main/unpack.c +++ b/src/main/unpack.c @@ -607,7 +607,7 @@ pkg_remove_conffile_on_upgrade(struct pkginfo *pkg, struct fsys_namenode *nameno usenode = namenodetouse(namenode, pkg, &pkg->installed); rc = conffderef(pkg, &cdr, usenode->name); - if (rc == -1) { + if (rc < 0) { debug(dbg_conffdetail, "%s: '%s' conffile dereference error: %s", __func__, namenode->name, strerror(errno)); namenode->oldhash = EMPTYHASHFLAG; -- Dpkg.Org's dpkg

