[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#147872: dpkg: doesn't set /var/lib/dpkg/lock to close on exec



Package: dpkg
Version: 1.9.21-se1
Severity: normal

This bug allows child processes of dpkg access to the lock file.

The following patch appears to fix the problem.  The bug in the code is that
the if statement in question should check for (n == 0) (I think) but in any
case there's no harm in setting the file handle to FD_CLOEXEC if it is already
in that state, so we may as well set it unconditionally.


diff -ru /tmp/dpkg-1.9.21/lib/lock.c ./lib/lock.c
--- /tmp/dpkg-1.9.21/lib/lock.c	Mon Apr 23 13:29:30 2001
+++ ./lib/lock.c	Thu May 23 10:32:10 2002
@@ -78,7 +78,6 @@
       ohshit(_("status database area is locked by another process"));
     ohshite(_("unable to lock dpkg status database"));
   }
-  n= fcntl(dblockfd, F_GETFD);
-  if (n >= 0) fcntl(dblockfd, F_SETFD, n | FD_CLOEXEC);
+  fcntl(dblockfd, F_SETFD, n | FD_CLOEXEC);
   push_cleanup(cu_unlockdb,~0, NULL,0, 0);
 }

-- System Information
Debian Release: 3.0
Kernel Version: Linux lyta 2.4.18lsm #1 Mon Apr 22 16:08:25 CEST 2002 i686 unknown

Versions of the packages dpkg depends on:
ii  libc6          2.2.5-6        GNU C Library: Shared libraries and Timezone
ii  libncurses5    5.2.20020112a- Shared libraries for terminal handling
ii  libstdc++2.10- 2.95.4-9       The GNU stdc++ library


-- 
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: