[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: I didn't tell them to look in the current directory
From: |
Hans-Bernhard Broeker |
Subject: |
Re: I didn't tell them to look in the current directory |
Date: |
29 Apr 2002 11:29:30 GMT |
Dan Jacobson <address@hidden> wrote:
> $ cd xxxx
> $ chmod 0 .
> $ find ~/oriented/queue/
> find: cannot open current directory: Permission denied
> Hurmf, why is it trying to open the current directory?
Because find works by chdir()ing into all the directories it visits.
To make sure it can return you to the original working directory, it
opens it and keeps that handle open all the time. That way, it can
fchdir() to it at the end of its job, and also in case of abnormal
early termination.
This serves as a measure against somebody killing that directory while
find is working, leaving the program with no sensible directory to
return to after it finished its work.
--
Hans-Bernhard Broeker (address@hidden)
Even if all the snow were burnt, ashes would remain.