summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2018-03-25 15:12:57 +0200
committerGuillem Jover <guillem@debian.org>2018-03-26 15:30:18 +0200
commit88d4da0a6c8ae18ddce08cee27c16abb72f8c454 (patch)
tree26126e7b0892de202da4ff3a862cff5a9ae8e893
parentf87f8d43113a48e2a9b5261dca758e87895721f2 (diff)
downloaddpkg-88d4da0a6c8ae18ddce08cee27c16abb72f8c454.tar.gz
dselect: Fix assert() to expect methlockfd to be initialized
The assert should be checking whether the method lock fd has been initialized, not whether it's not zero, which happens to be the case with the default uninitialized -1 value.
-rw-r--r--debian/changelog2
-rw-r--r--dselect/method.cc2
2 files changed, 3 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 658148424..fcaa5288a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -40,6 +40,8 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
Reported by Heinz Repp <heinz.repp@arcor.de>. Closes: #888983
* Switch a DEBIAN/conffile parsing assert() in dpkg due to empty lines
into an ohshit(), because this is really a run-time error.
+ * Fix assert() in dselect to expect the method lock file descriptor to be
+ initialized, instead of non-zero.
* Architecture support:
- Add support for riscv64 CPU. Closes: #822914
Thanks to Manuel A. Fernandez Montecelo <mafm@debian.org>
diff --git a/dselect/method.cc b/dselect/method.cc
index ef5c4c344..74ac9842c 100644
--- a/dselect/method.cc
+++ b/dselect/method.cc
@@ -72,7 +72,7 @@ static void cu_unlockmethod(int, void**) {
struct flock fl;
assert(methodlockfile);
- assert(methlockfd);
+ assert(methlockfd >= 0);
fl.l_type=F_UNLCK; fl.l_whence= SEEK_SET; fl.l_start=fl.l_len=0;
if (fcntl(methlockfd,F_SETLK,&fl) == -1)
sthfailed(_("cannot unlock access method area"));