From 45d4e8bba034c22c317fbd20c629589e35d97683 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 1 Mar 2018 17:15:07 -0500 Subject: [PATCH] Improve the error message for most types of inaccessible paths. --- run-tests.sh | 3 --- src/apply-default-acl.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index 3ac659f..3741430 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -672,14 +672,12 @@ compare # we get the expected error. TESTNUM=25 ACTUAL=$( "${BIN}" test/nonexistent 2>&1 ) -ACTUAL="${ACTUAL#*: }" EXPECTED="test/nonexistent: No such file or directory" compare # Same as the previous test, but with --recursive. TESTNUM=26 ACTUAL=$( "${BIN}" --recursive test/nonexistent 2>&1 ) -ACTUAL="${ACTUAL#*: }" EXPECTED="test/nonexistent: No such file or directory" compare @@ -690,7 +688,6 @@ DUMMY1="${TESTDIR}/dummy1" DUMMY2="${TESTDIR}/dummy2" touch "${DUMMY1}" "${DUMMY2}" ACTUAL=$( "${BIN}" "${DUMMY1}" test/nonexistent "${DUMMY2}" 2>&1 ) -ACTUAL="${ACTUAL#*: }" EXPECTED="test/nonexistent: No such file or directory" compare diff --git a/src/apply-default-acl.c b/src/apply-default-acl.c index 3350a19..a520aa9 100644 --- a/src/apply-default-acl.c +++ b/src/apply-default-acl.c @@ -257,7 +257,7 @@ int main(int argc, char* argv[]) { * typos, too. */ if (!path_accessible(target)) { - fprintf(stderr, "%s: %s: No such file or directory\n", argv[0], target); + perror(target); result = EXIT_FAILURE; continue; } -- 2.44.2