Re: atomically opening and deleting a file

2002-06-12 Thread Muli Ben-Yehuda
On Wed, Jun 12, 2002 at 10:45:02AM +0300, guy keren wrote: > > On Wed, 12 Jun 2002, Muli Ben-Yehuda wrote: > > > Using a secure, private directory was indeed the answer. Thanks to > > everyone who replied. The code, for the curious, is available at > > >http://cvs.sourceforge.net/cgi-bin/viewcv

Re: atomically opening and deleting a file

2002-06-12 Thread guy keren
On Wed, 12 Jun 2002, Muli Ben-Yehuda wrote: > Using a secure, private directory was indeed the answer. Thanks to > everyone who replied. The code, for the curious, is available at > >http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/syscalltrack/syscalltrack/tests/tester.c?rev=1.25&content-type=te

Re: atomically opening and deleting a file

2002-06-11 Thread Muli Ben-Yehuda
On Wed, Jun 12, 2002 at 11:21:18AM +0300, Adi Stav wrote: > On Tue, Jun 11, 2002 at 01:25:11PM +0300, Muli Ben-Yehuda wrote: > > Is there a way to open a file (get an fd) and then delete it, in one > > atomic operation? > > > > I need to open a temporary file (but with a fixed name, so mkstemp()

Re: Mutt Threading (was: Re: atomically opening and deleting a file)

2002-06-11 Thread Christoph Bugel
On 2002-06-11, Michael Rozhavsky wrote: > > [snip] > > > Sorry, seems like I missed most of the discussions on this thread, because > > mutt was thinking that these messages belong to another random thread. This > > seems to happens with other threads too. Either bug in mutt (I upgraded to > >

Re: Mutt Threading (was: Re: atomically opening and deleting a file)

2002-06-11 Thread Michael Rozhavsky
[snip] > Sorry, seems like I missed most of the discussions on this thread, because > mutt was thinking that these messages belong to another random thread. This > seems to happens with other threads too. Either bug in mutt (I upgraded to > 1.4 a few days ago) or something else I did wrong.. >

Mutt Threading (was: Re: atomically opening and deleting a file)

2002-06-11 Thread Christoph Bugel
On 2002-06-11, Christoph Bugel wrote: > On 2002-06-11, Muli Ben-Yehuda wrote: > > open("foo", ...); > > unlink("foo", ...); > > > > is obviously unsafe, since foo might be pointing to something else by > > the time I unlink it. Suggestions? > > You know that you can do the unlink *immediately*

Re: atomically opening and deleting a file

2002-06-11 Thread Christoph Bugel
On 2002-06-11, Muli Ben-Yehuda wrote: > Is there a way to open a file (get an fd) and then delete it, in one > atomic operation? > > I need to open a temporary file (but with a fixed name, so mkstemp() > and friends are not an option) and then make sure it doesn't remain > behind if the program

Re: atomically opening and deleting a file

2002-06-11 Thread Moshe Zadka
On Tue, 11 Jun 2002, guy keren <[EMAIL PROTECTED]> wrote: > for mode changing, there is 'fchmod'. for exec, there is 'fexecv'. but > there is no 'funlink', i'm afraid. For good reasons: f* is things that are kept in the inode, which is reproducable from the fd. The *name* however, is not unique

Re: atomically opening and deleting a file

2002-06-11 Thread Shachar Shemesh
Muli Ben-Yehuda wrote: >I have a patch implementing this already written. However, it doesn't >protect us from the synlink attack. > > > Sure it does. Just make sure noone but you have write permissions on the directory. No write permissions - no rename capabilities, no ability to symlink.

Re: atomically opening and deleting a file

2002-06-11 Thread guy keren
On Tue, 11 Jun 2002, Muli Ben-Yehuda wrote: > > > Because I'm doing it as part of syscalltrack's test suite, and it > > > needs to be a fixed name so that I'll be able to make rules to match > > > on it. We do support pattern matching, so I could use mkstemp() with a > > > fixed template, but I

Re: atomically opening and deleting a file

2002-06-11 Thread Muli Ben-Yehuda
On Tue, Jun 11, 2002 at 02:10:18PM +0300, guy keren wrote: > > On Tue, 11 Jun 2002, Muli Ben-Yehuda wrote: > > > > > I need to open a temporary file (but with a fixed name, so mkstemp() > > > > and friends are not an option) > > > > > > Why a fixed name? Can it be a symlink? > > > > Because I'm

Re: atomically opening and deleting a file

2002-06-11 Thread guy keren
On Tue, 11 Jun 2002, Muli Ben-Yehuda wrote: > > > I need to open a temporary file (but with a fixed name, so mkstemp() > > > and friends are not an option) > > > > Why a fixed name? Can it be a symlink? > > Because I'm doing it as part of syscalltrack's test suite, and it > needs to be a fixed n

Re: atomically opening and deleting a file

2002-06-11 Thread Muli Ben-Yehuda
On Tue, Jun 11, 2002 at 01:52:29PM +0300, Tzafrir Cohen wrote: > On Tue, 11 Jun 2002, Muli Ben-Yehuda wrote: > > > Is there a way to open a file (get an fd) and then delete it, in one > > atomic operation? > > > > I need to open a temporary file (but with a fixed name, so mkstemp() > > and friend

Re: atomically opening and deleting a file

2002-06-11 Thread Tzafrir Cohen
On Tue, 11 Jun 2002, Muli Ben-Yehuda wrote: > Is there a way to open a file (get an fd) and then delete it, in one > atomic operation? > > I need to open a temporary file (but with a fixed name, so mkstemp() > and friends are not an option) Why a fixed name? Can it be a symlink? > and then make

atomically opening and deleting a file

2002-06-11 Thread Muli Ben-Yehuda
Is there a way to open a file (get an fd) and then delete it, in one atomic operation? I need to open a temporary file (but with a fixed name, so mkstemp() and friends are not an option) and then make sure it doesn't remain behind if the program should die unexpectedly. Doing open("foo", ...);