diff options
author | Rob Landley <rob@landley.net> | 2014-10-22 17:11:06 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-10-22 17:11:06 -0500 |
commit | 9b891d54c9fa422bb2dc87bde2b741d71441dfbb (patch) | |
tree | b93dd7732bd85fe22dd5add0474f8b52c6846d1c /lib/args.c | |
parent | 9b0d8691b9dad6674ea6d778bebcf3bbd76cc6de (diff) | |
download | toybox-9b891d54c9fa422bb2dc87bde2b741d71441dfbb.tar.gz |
Teach ln -f to leave original target alone if link creation fails.
Suggested by Ashwini Sharma, I wound up implementing it by creating the new
link at a temporary name and renaming it over the old one instead of renaming
the old file out of the way and putting it back if it failed.
(Because "mkdir -p one/one/blah && ln -sf /bin/one one" would otherwise
rename one/one out of the way and only notice it can't delete it way at the
end when recovery's darn awkward, vs create new thing and if rename fails
(including EISDIR) that's the main error path. And yes the temporary name
is in the same directory as the destination so we never rename between mounts.)
link over the old one instead of renaming the old file and renaming it back.
Diffstat (limited to 'lib/args.c')
0 files changed, 0 insertions, 0 deletions