diff options
Diffstat (limited to 'coreutils/ln.c')
-rw-r--r-- | coreutils/ln.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/coreutils/ln.c b/coreutils/ln.c index ddad120d1..6da290c11 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -40,8 +40,12 @@ int ln_main(int argc, char **argv) | |||
40 | last = argv[argc - 1]; | 40 | last = argv[argc - 1]; |
41 | argv += optind; | 41 | argv += optind; |
42 | 42 | ||
43 | if (argc == optind + 1) { | 43 | if (!argv[1]) { |
44 | /* "ln PATH/TO/FILE" -> "ln PATH/TO/FILE FILE" */ | ||
44 | *--argv = last; | 45 | *--argv = last; |
46 | /* xstrdup is needed: "ln -s PATH/TO/FILE/" is equivalent to | ||
47 | * "ln -s PATH/TO/FILE/ FILE", not "ln -s PATH/TO/FILE FILE" | ||
48 | */ | ||
45 | last = bb_get_last_path_component_strip(xstrdup(last)); | 49 | last = bb_get_last_path_component_strip(xstrdup(last)); |
46 | } | 50 | } |
47 | 51 | ||