BugTraq
Changes to the filesystem while find is running - comments? Nov 22 2004 10:27AM
James Youngman (bugtraq excession spiral-arm org) (1 replies)
Re: Changes to the filesystem while find is running - comments? Nov 22 2004 06:05PM
Martin Buchholz (Martin Buchholz Sun COM) (2 replies)
Re: Changes to the filesystem while find is running - comments? Nov 22 2004 11:51PM
James Youngman (bugtraq excession spiral-arm org) (3 replies)
Re: Changes to the filesystem while find is running - comments? Nov 24 2004 07:51AM
Casper Dik Sun COM (2 replies)
Re: Changes to the filesystem while find is running - comments? Nov 24 2004 05:25PM
Martin Buchholz (Martin Buchholz Sun COM) (1 replies)
Re: Changes to the filesystem while find is running - comments? Nov 24 2004 12:15PM
James Youngman (bugtraq excession spiral-arm org)
Re: Changes to the filesystem while find is running - comments? Nov 24 2004 05:24AM
devnull Rodents Montreal QC CA
(Because I'm so sick of the broken autoresponders bugtraq is full of,
I've set the From: on this mail to a black-hole address. Please use
the address in the signature if you actually want to reach me.)

>> Before a chdir to "foo", take stock:
>> - record stat("."); DOTFD = open("."); (get a fd to ".")

This is not possible if . is a search-only directory. (While find will
not work very well in such a directory, care should be taken that it
not fall over just because someone happened to chmod the read bits away
from a directory just when find happens to be in it.)

More generally, I've wanted to do this - use file descriptors as
handles onto directories - and often wished for an O_NOACCESS mode to
open() in consequence.

> Of course, open(2) will follow a symlink, if the directory we
> originally stat()ed is replaced by a symlink just before we issue the
> open() call. We of course can guard against that by issuing an
> lstat() on the fd once we have opened it.

ITYPM fstat(), not lstat(), in the last line.

/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse (at) rodents.montreal.qc (dot) ca [email concealed]
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B

[ reply ]
Re: Changes to the filesystem while find is running - comments? Nov 23 2004 02:05AM
Martin Buchholz (Martin Buchholz Sun COM) (1 replies)
Re: Changes to the filesystem while find is running - comments? Nov 23 2004 09:17AM
James Youngman (bugtraq excession spiral-arm org) (1 replies)
Re: Changes to the filesystem while find is running - comments? Nov 23 2004 05:59PM
Martin Buchholz (Martin Buchholz Sun COM)
Re: Changes to the filesystem while find is running - comments? Nov 22 2004 06:33PM
Dmitry V. Levin (ldv altlinux org)


 

Privacy Statement
Copyright 2010, SecurityFocus