help-hurd
[Top][All Lists]
Advanced

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

Re: recursive commands


From: Niels Möller
Subject: Re: recursive commands
Date: 02 Apr 2002 18:58:20 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

Oystein Viggen <oysteivi@tihlde.org> writes:

> * [Craig Allan Jeffree] 
> 
> >>  old = open(".");
> >>  chdir("foo);
> >>  delete stuff
> >>  fchdir(old);
> >>  delete more stuff
> >>
> > Isn't this potentially racey as well?

You're right that one has to take more care when chdir:ing to "foo"
too. I was thinking about the chdir in the other direction. Here,

  int old = open(".", ...);
  chdir("foo"); /* Safe as long as we don't do anything in foo */
  fchdir(old);
  unlink("bar");

should be equivalent to simply

  unlink("bar")

The same name in the same directory will be deleted, no matter if the
current directory or the foo subdirectory is moved around under our
feet.

/Niels



reply via email to

[Prev in Thread] Current Thread [Next in Thread]