summaryrefslogtreecommitdiffstats
path: root/dselect/method.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:08 +0000
commit44cf9c6d2d274eac37502e835155f7e985f1b8e6 (patch)
tree9576ba968924c5b9a55ba9e14f4f26184c62c7d4 /dselect/method.cc
parentAdding upstream version 1.22.6. (diff)
downloaddpkg-44cf9c6d2d274eac37502e835155f7e985f1b8e6.tar.xz
dpkg-44cf9c6d2d274eac37502e835155f7e985f1b8e6.zip
Adding upstream version 1.22.7.upstream/1.22.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dselect/method.cc')
-rw-r--r--dselect/method.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/dselect/method.cc b/dselect/method.cc
index 5e7972f..ed7e834 100644
--- a/dselect/method.cc
+++ b/dselect/method.cc
@@ -75,7 +75,7 @@ static void cu_unlockmethod(int, void**) {
if (methlockfd < 0)
internerr("method lock fd is %d < 0", methlockfd);
fl.l_type=F_UNLCK; fl.l_whence= SEEK_SET; fl.l_start=fl.l_len=0;
- if (fcntl(methlockfd,F_SETLK,&fl) == -1)
+ if (fcntl(methlockfd, F_SETLK, &fl) < 0)
sthfailed(_("cannot unlock access method area"));
}
@@ -104,9 +104,9 @@ static enum urqresult lockmethod(void) {
if (methodlockfile == nullptr)
methodlockfile = dpkg_db_get_path(METHLOCKFILE);
- if (methlockfd == -1) {
+ if (methlockfd < 0) {
methlockfd= open(methodlockfile, O_RDWR|O_CREAT|O_TRUNC, 0660);
- if (methlockfd == -1) {
+ if (methlockfd < 0) {
if ((errno == EPERM) || (errno == EACCES)) {
sthfailed(_("requested operation requires superuser privilege"));
return urqr_fail;
@@ -116,7 +116,7 @@ static enum urqresult lockmethod(void) {
}
}
fl.l_type=F_WRLCK; fl.l_whence=SEEK_SET; fl.l_start=fl.l_len=0;
- if (fcntl(methlockfd,F_SETLK,&fl) == -1) {
+ if (fcntl(methlockfd, F_SETLK, &fl) < 0) {
if (errno == EACCES || errno == EAGAIN) {
sthfailed(_("the access method area is already locked"));
return urqr_fail;