diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2018-06-13 18:45:12 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2018-06-25 12:08:37 +0200 |
commit | 1edcb718293f24ad190703a345f8f868b6e3bcc4 (patch) | |
tree | 247462d7c4eb6bffc9f77bb50ebe03ae4343a7af /apt-private/private-moo.cc | |
parent | ca28001a735e10339b104ad757e47219ec11bcb6 (diff) |
Fix lock counting in debSystem
debSystem uses a reference counted lock, so you can acquire it
multiple times in your applications, possibly nested. Nesting
locks causes a fd leak, though, as we only increment the lock
count when we already have locked twice, rather than once, and
hence when we call lock the second time, instead of increasing
the lock count, we open another lock fd.
This fixes the code to check if we have locked at all (> 0).
There is no practical problem here aside from the fd leak, as
closing the new fd releases the lock on the old one due to the
weird semantics of fcntl locks.
(cherry picked from commit 79f012bd09ae99d4c9d63dc0ac960376b5338b32)
Diffstat (limited to 'apt-private/private-moo.cc')
0 files changed, 0 insertions, 0 deletions