struct namei *next; /* next item */
int level;
int mountpoint; /* is mount point */
- int noent; /* is this item not existing */
+ int noent; /* this item not existing (stores errno from stat()) */
};
static int flags;
nm->level = lev;
nm->name = xstrdup(fname);
- nm->noent = (lstat(path, &nm->st) == -1);
- if (nm->noent)
+ if (lstat(path, &nm->st) != 0) {
+ nm->noent = errno;
return nm;
+ }
if (S_ISLNK(nm->st.st_mode))
readlink_to_namei(nm, path);
blanks += 1;
blanks += nm->level * 2;
printf("%*s ", blanks, "");
- printf(_("%s - No such file or directory\n"), nm->name);
+ printf("%s - %s\n", nm->name, strerror(nm->noent));
return -1;
}
" -l, --long use a long listing format (-m -o -v) \n"
" -n, --nosymlinks don't follow symlinks\n"
" -v, --vertical vertical align of modes and owners\n"), out);
- print_usage_help_options(21);
+ printf(USAGE_HELP_OPTIONS(21));
- fprintf(out, USAGE_MAN_TAIL("namei(1)"));
+ printf(USAGE_MAN_TAIL("namei(1)"));
exit(EXIT_SUCCESS);
}