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]);
|
eprintf("realpath %s:", argv[0]);
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
p = dirname(estrdup(argv[0]));
|
if (!realpath(argv[0], b))
|
||||||
if (!realpath(p, b))
|
eprintf("realpath %s:", argv[0]);
|
||||||
eprintf("realpath %s:", p);
|
|
||||||
estrlcat(b, "/", sizeof(arg));
|
|
||||||
estrlcat(b, basename(estrdup(argv[0])), sizeof(arg));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ((n = readlink(argv[0], b, PATH_MAX - 1)) < 0)
|
if ((n = readlink(argv[0], b, PATH_MAX - 1)) < 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user