[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dd new iflag= oflag= flags directory, nolinks

From: Eric Blake
Subject: Re: dd new iflag= oflag= flags directory, nolinks
Date: Tue, 21 Mar 2006 21:25:15 -0700
User-agent: Thunderbird 1.5 (Windows/20051201)

Hash: SHA1

According to Olivier Delhomme on 3/8/2006 12:45 PM:
> Le Mon, 06 Mar 2006 18:20:12 -0500, Phillip Susi disait :
>> I'm confused.  You can't open() and write() to a directory, so how does 
>> it make any sense to ask dd to set O_DIRECTORY?
> So do I ...I never used open() with a directory, but why shouldn't it
> be possible ?

It's possible to open directories read-only, but then you can't read()
that file descriptor.  Beyond atomic existance checks, about all that can
be usefully done with a directory fd is using fdopendir() on it (as a
replacement to opendir, especially useful when using openat() and
friends).  But I still think Paul's patch was worthwhile, from the
completeness point of view - dd now supports every O_* flag possible, even
if there is not much use for it.

> I looked to the man 2 open page and I saw the following which confuses
> me more :
>               If  pathname  is not a directory, cause the open to
> fail.  This flag is Linux-specific, and was added in kernel version
> 2.1.126, to avoid denial-of- service problems if opendir(3) is called
> on a FIFO or tape device, but should not be used outside of the
> implementation of opendir.
> So if this flag is linux specific does it mean that dd iflag=directory
> won't run on other unices ?

The dd code is conditionally compiled so that platforms not supporting the
various O_* flags do not accept that particular flag, nor document it in
the --help output.  Just as you can't use dd iflag=directory on Solaris,
you can't use dd iflag=nolinks on Linux.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


reply via email to

[Prev in Thread] Current Thread [Next in Thread]