Phillip Susi <address@hidden> writes:
> What is atomic about having dd do this? open() with O_DIRECTORY to test for
> existence of a directory is exactly what test does isn't it?
No, because "test -d foo && test -r foo" is _two_ invocations of
"test", not one. A race condition is therefore possible. The race
condition is not possible with dd if=foo iflag=directory count=0.
Admittedly this usage is unusual. The main arguments for it are
(1) "dd" supports all the other O_* flags, so why not O_DIRECTORY? and
(2) I ran into a situation where I could use O_DIRECTORY.
(1) is far more important than (2).