From 7d20408ec4a5dbc973520dd78dd2531c6a1471c7 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Thu, 5 Dec 2013 23:38:53 +0100 Subject: trans: fix reference counting bug in fakeroot The function new_node creates virtual nodes using netfs_make_node. Nodes created with netfs_make_node already have a reference count of one. Currently another reference is added in new_node. This prevents the destruction of the node causing bugs like this: % fakeroot-hurd sh -c 'l(){ flock /tmp/$$.lock true; }; l; l' * trans/fakeroot.c (new_node): Fix reference count of newly created nodes. --- trans/fakeroot.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/trans/fakeroot.c b/trans/fakeroot.c index d5cb0e6d..5c4854d1 100644 --- a/trans/fakeroot.c +++ b/trans/fakeroot.c @@ -108,10 +108,7 @@ new_node (file_t file, mach_port_t idport, int locked, int openmodes, pthread_mutex_lock (&idport_ihash_lock); err = hurd_ihash_add (&idport_ihash, nn->idport, nn); if (!err) - { - pthread_mutex_lock (&(*np)->lock); - netfs_nref (*np); /* Return a reference to the caller. */ - } + pthread_mutex_lock (&(*np)->lock); pthread_mutex_unlock (&idport_ihash_lock); } if (err) -- cgit v1.2.3