From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lennart Poettering Date: Sat, 05 Sep 2009 08:19:50 +0000 Subject: Re: [PATCH] race between util_create_path() and util_delete_path()? Message-Id: <20090905081950.GA18519@tango.0pointer.de> List-Id: References: <20090904192743.GO4363@florz.florz.dyndns.org> In-Reply-To: <20090904192743.GO4363@florz.florz.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Fri, 04.09.09 21:27, Florian Zumbiehl (florz@florz.de) wrote: > plus, it seems to be the simpler solution by far - which is why I went > with flock() in my suggested fix you find below. Untested, as usual, and > I don't really have a clue whether there are any unhealthy interactions > with the rest of udev in this solution. Also, you most likely will want > to change the path of the lock file ;-) Never use flock. All Unix locking APIs are broken in one way or the other. But if you use one then at least use fcntl(F_SETLK) which is the least broken. Lennart -- Lennart Poettering Red Hat, Inc. lennart [at] poettering [dot] net http://0pointer.net/lennart/ GnuPG 0x1A015CC4