Re: rm-ing files with open file descriptors

Miquel van Smoorenburg (miquels@cistron.nl)
Sun, 20 Jan 2002 23:10:57 +0000 (UTC)


In article <843d119h0g.fsf@rjk.greenend.org.uk>,
Richard Kettlewell <rjk@terraraq.org.uk> wrote:
>If the file descriptor you have was opened O_RDONLY, but you have
>write permission on the file itself, then creating a new name for it
>would allow you to open it O_RDWR.

/proc allows for this anyway.

open("knuth.txt", O_RDONLY) = 3
unlink("knuth.txt") = 0
open("/proc/self/fd/3", O_RDWR) = 4

Mike.

-
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/