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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/