sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit d475a6bdf24f6a2c040def66676b5105b42d3b63
parent 3946d1fcc91a4d265c5d718c090ce3fa21b646f2
Author: sin <sin@2f30.org>
Date:   Thu, 22 Jan 2015 16:26:30 +0000

Handle ln -sf a foo/ correctly

Previously it would not delete foo/a if it already existed.  Use
unlinkat() instead to do that.

Diffstat:
Mln.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ln.c b/ln.c @@ -67,7 +67,7 @@ main(int argc, char *argv[]) if (!hasto) to = basename(argv[0]); if (fflag) - remove(to); + unlinkat(dirfd, to, 0); if ((!sflag ? linkat(AT_FDCWD, argv[0], dirfd, to, flags) : symlinkat(argv[0], dirfd, to)) < 0) { eprintf("%s %s <- %s:", fname, argv[0], to);