readlink: simplify -f
Use output from realpath(3) directly. This makes usage with . more consistent with other implementations.
This commit is contained in:
parent
7e035a9a2e
commit
93043beec9
|
@ -76,11 +76,8 @@ mdone:
|
|||
eprintf("realpath %s:", argv[0]);
|
||||
break;
|
||||
case 'f':
|
||||
p = dirname(estrdup(argv[0]));
|
||||
if (!realpath(p, b))
|
||||
eprintf("realpath %s:", p);
|
||||
estrlcat(b, "/", sizeof(arg));
|
||||
estrlcat(b, basename(estrdup(argv[0])), sizeof(arg));
|
||||
if (!realpath(argv[0], b))
|
||||
eprintf("realpath %s:", argv[0]);
|
||||
break;
|
||||
default:
|
||||
if ((n = readlink(argv[0], b, PATH_MAX - 1)) < 0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user