diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:30:08 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-07 13:30:08 +0000 |
commit | 44cf9c6d2d274eac37502e835155f7e985f1b8e6 (patch) | |
tree | 9576ba968924c5b9a55ba9e14f4f26184c62c7d4 /dselect/method.cc | |
parent | Adding upstream version 1.22.6. (diff) | |
download | dpkg-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.cc | 8 |
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; |