pwdx: write errors to stderr

Includes also magic number removal (return value 1 to EXIT_FAILURE),
and proper null assignment to end of string.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2011-12-18 15:37:02 +01:00
parent 741de935ef
commit 2c8b3a7857

4
pwdx.c
View File

@ -98,7 +98,9 @@ int main(int argc, char *argv[])
if (len < 0) {
s = strerror(errno == ENOENT ? ESRCH : errno);
retval = 1;
retval = EXIT_FAILURE;
fprintf(stderr, "%s: %s\n", argv[i], s);
continue;
} else {
pathbuf[len] = 0;
s = pathbuf;