Bläddra i källkod

dselect: Use EACCES instead of EWOULDBLOCK for fcntl(2) F_SETLK

This fcntl(2) sub-command returns either EACCES or EAGAIN on error.

Warned-by: gcc-6
Guillem Jover 10 år sedan
förälder
incheckning
742cb8c4fd
2 ändrade filer med 3 tillägg och 2 borttagningar
  1. 1 0
      debian/changelog
  2. 2 2
      dselect/method.cc

+ 1 - 0
debian/changelog

@@ -6,6 +6,7 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
     and dpkg-scansources. Closes: #809219
     and dpkg-scansources. Closes: #809219
   * Implement delete operator with size argument in dselect, required by the
   * Implement delete operator with size argument in dselect, required by the
     C++14 spec when the size-less delete operator is defined.
     C++14 spec when the size-less delete operator is defined.
+  * Use EACCES instead of EWOULDBLOCK for fcntl(2) F_SETLK in dselect.
   * Documentation:
   * Documentation:
     - Say value instead of option in deb-control(5).
     - Say value instead of option in deb-control(5).
     - Mark debian changelog format in bold in dpkg-parsechangelog(1).
     - Mark debian changelog format in bold in dpkg-parsechangelog(1).

+ 2 - 2
dselect/method.cc

@@ -120,10 +120,10 @@ static enum urqresult lockmethod(void) {
   }
   }
   fl.l_type=F_WRLCK; fl.l_whence=SEEK_SET; fl.l_start=fl.l_len=0;
   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) == -1) {
-    if (errno == EWOULDBLOCK || errno == EAGAIN) {
+    if (errno == EACCES || errno == EAGAIN) {
       sthfailed(_("the access method area is already locked"));
       sthfailed(_("the access method area is already locked"));
       return urqr_fail;
       return urqr_fail;
-      }
+    }
     sthfailed(_("cannot lock access method area"));
     sthfailed(_("cannot lock access method area"));
     return urqr_fail;
     return urqr_fail;
   }
   }