LKML Archive on
help / color / mirror / Atom feed
* atomic unlink filename only if everything but basename is no  symlink?
@ 2015-01-26  9:53 Axel Kittenberger
  0 siblings, 0 replies; only message in thread
From: Axel Kittenberger @ 2015-01-26  9:53 UTC (permalink / raw)
  To: linux-kernel

Is there a Linux system call that allows one to call unlink() to execute
properly only if no part of the path is a symlink? Except the basename of
course since that would be simply removing the symlink itself?

The issue is with some tools like Lsyncd this can lead to removes outside
of what is expected if one part of the path happened to become a symlink
to some place where it shouldn't operate.

I could test if a "realpath -s PATH" is equals to "realpath PATH" but the
basename, but even if I coded that, there would still be a racecondition
by something else replacing one physical directory by a symlink just
between the test and the call to unlink, so it unlinks something it didn't
want to.

Like there is now lchown should there be a lunlink() systemcall or an
option to unlink()? Or a global process flag like "do not follow *any*
symlinks for me please (including my subprocesses)"?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-26 10:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26  9:53 atomic unlink filename only if everything but basename is no symlink? Axel Kittenberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).