Re: Proposal: restrict link(2)

Keith Rohrer (kwrohrer@uiuc.edu)
Fri, 13 Dec 1996 19:48:42 -0600 (CST)


> Why not just make link() create a symlink instead of throwing it away
> alltogether (yes and i know it might break some weird program somewhere,
> but it will do away with your supposed chown() bug)..
Ecch! God, no! One way of renaming files without having to own them
or make sure the permissions stay right or anything like that, is
ln old new && rm old (usually done in C, not shell, but the idea's there).
If ln works right, it renames old to new; if ln fails, nothing happens;
if ln succeeds but makes a symlink instead of a hard link, you get a
dangling link and lose the original file. Better to fail than to do the
wrong thing.

Keith