From: Legacy Fishtank <garzik@havoc.gtf.org>
To: Pavel Roskin <proski@gnu.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: readdir() loses entries on ramfs and tmpfs
Date: Wed, 26 Dec 2001 22:08:40 -0500 [thread overview]
Message-ID: <20011226220840.A32612@havoc.gtf.org> (raw)
In-Reply-To: <Pine.LNX.4.43.0112261932350.26802-100000@marabou.research.att.com>
In-Reply-To: <Pine.LNX.4.43.0112261932350.26802-100000@marabou.research.att.com>; from proski@gnu.org on Wed, Dec 26, 2001 at 07:50:11PM -0500
On Wed, Dec 26, 2001 at 07:50:11PM -0500, Pavel Roskin wrote:
> I got a report that GNU Midnight Commander fails to erase some directories
> on tmpfs from the first attempt. However, it succeeds the next time.
[...]
> while ((d = readdir(dir)) != NULL) {
> printf("%s\n", d->d_name);
> rmdir(d->d_name);
> }
[...]
> I'm sorry, I cannot elaborate more, but the issue seems to be very
> serious.
If Midnight Commander does similar to the above it's pretty silly...
In Perl I normally do something like this in a loop (with a max-loops
limiter):
opendir
@dirs = readdir(FOO);
closedir
last unless @dirs;
&remove_the_dirs(@dirs);
Clearly that's slack since you could have a million files in a
directory, but you see the point. readdir(2) and getdents(2)
are inherently racy. If your code does not assume such and take
appropriate action, it's broken.
Jeff
prev parent reply other threads:[~2001-12-27 3:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-27 0:50 Pavel Roskin
2001-12-27 1:52 ` Edgar Toernig
2001-12-27 3:08 ` Legacy Fishtank [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011226220840.A32612@havoc.gtf.org \
--to=garzik@havoc.gtf.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=proski@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®