summaryrefslogtreecommitdiffstats
path: root/dselect/method.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:11 +0000
commitb4f7d8b1566e3220d0e9004499ef9c257e079c57 (patch)
treece0468ca8cf21380bef3d2aaacc9fcb30116e757 /dselect/method.cc
parentReleasing progress-linux version 1.22.6-0.0~progress7.99u1. (diff)
downloaddpkg-b4f7d8b1566e3220d0e9004499ef9c257e079c57.tar.xz
dpkg-b4f7d8b1566e3220d0e9004499ef9c257e079c57.zip
Merging upstream version 1.22.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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;