- use MAXPATHLEN per realpath(3)
- use the problematic part of the path, instead of the argument, when reporting an error. Reviewed by: mike
This commit is contained in:
parent
0c21294cee
commit
9a26e46eb4
@ -46,7 +46,7 @@ static void usage(void) __dead2;
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
char buf[MAXPATHLEN];
|
||||
char *p;
|
||||
|
||||
if (argc == 1) {
|
||||
@ -54,7 +54,7 @@ main(int argc, char *argv[])
|
||||
err(1, "getcwd()");
|
||||
} else if (argc == 2) {
|
||||
if ((p = realpath(argv[1], buf)) == NULL)
|
||||
err(1, "%s", argv[1]);
|
||||
err(1, "%s", buf);
|
||||
} else
|
||||
usage();
|
||||
(void)printf("%s\n", p);
|
||||
|
Loading…
Reference in New Issue
Block a user