diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-12-04 15:25:53 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-12-04 15:25:53 -0500 |
commit | 9bdd0f8cff8a6c5f1fa61dfe4e6a4ed297248d80 (patch) | |
tree | 889fc95e8c6fe2156c88f06363c632699d13d397 | |
parent | 69b820fa2c271f1eafaf692a0a8e57e22e83daa3 (diff) |
-rw-r--r-- | ln.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -25,6 +25,7 @@ #define _POSIX_C_SOURCE 200809L #include <errno.h> #include <fcntl.h> +#include <libgen.h> #include <locale.h> #include <stdio.h> #include <string.h> @@ -39,8 +40,10 @@ enum { SYMBOLIC = 1 << 0, FORCE = 1 << 1 }; static int ln(const char *path, int dirfd, const char *target, int lnflag, int atflag) { + char base[strlen(path) + 1]; if (!target) { - target = path; + strcpy(base, path); + target = basename(base); } struct stat st; |