commit: 0bcbc6ade5461f1f1bd86d143f21fd87f42003b8
parent c899b4a8d9705d90415ce8ef735db7c2f33650a1
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 24 Sep 2022 05:41:39 +0200
cmd/xcd: Always prefix error message with "xcd: "
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/cmd/xcd.c b/cmd/xcd.c
@@ -194,7 +194,7 @@ concat(FILE *stream)
return 0;
werr:
- fprintf(stderr, "\n[0mWrite error: %s\n", strerror(errno));
+ fprintf(stderr, "\n[0mxcd: Write error: %s\n", strerror(errno));
return 1;
}
@@ -228,7 +228,7 @@ main(int argc, char *argv[])
FILE *file = fopen(argv[argi], "r");
if(!file)
{
- fprintf(stderr, "\n[0mError opening ‘%s’: %s\n", argv[argi], strerror(errno));
+ fprintf(stderr, "\n[0mxcd: Error opening ‘%s’: %s\n", argv[argi], strerror(errno));
err = 1;
goto cleanup;
}
@@ -239,7 +239,7 @@ main(int argc, char *argv[])
if(err != 0)
{
- fprintf(stderr, "\n[0mError closing ‘%s’: %s\n", argv[argi], strerror(errno));
+ fprintf(stderr, "\n[0mxcd: Error closing ‘%s’: %s\n", argv[argi], strerror(errno));
err = 1;
goto cleanup;
}
diff --git a/test-cmd/xcd b/test-cmd/xcd
@@ -28,7 +28,7 @@ noperm_body() {
touch inputs/chmod_000 || atf_fail "touching chmod_000"
chmod 0000 inputs/chmod_000 || atf_fail "chmod 0000 chmod_000"
# shellcheck disable=SC1112
- atf_check -s exit:1 -e 'inline:\n[0mError opening ‘inputs/chmod_000’: Permission denied\n' -o 'inline:[0m' ../cmd/xcd inputs/chmod_000
+ atf_check -s exit:1 -e 'inline:\n[0mxcd: Error opening ‘inputs/chmod_000’: Permission denied\n' -o 'inline:[0m' ../cmd/xcd inputs/chmod_000
}
noperm_cleanup() {
chmod 0600 inputs/chmod_000 || atf_fail "chmod 0600 chmod_000"
@@ -38,9 +38,9 @@ noperm_cleanup() {
atf_test_case devfull
devfull_body() {
# shellcheck disable=SC1112
- atf_check -s 'exit:1' -e 'inline:\n[0mWrite error: No space left on device\n\n[0mError closing ‘inputs/strings/true’: No space left on device\n' sh -c '../cmd/xcd inputs/strings/true >/dev/full'
- atf_check -s 'exit:1' -e 'inline:\n[0mWrite error: No space left on device\n' sh -c '../cmd/xcd <inputs/strings/true >/dev/full'
- atf_check -s 'exit:1' -e 'inline:\n[0mWrite error: No space left on device\n' sh -c '../cmd/xcd - <inputs/strings/true >/dev/full'
+ atf_check -s 'exit:1' -e 'inline:\n[0mxcd: Write error: No space left on device\n\n[0mxcd: Error closing ‘inputs/strings/true’: No space left on device\n' sh -c '../cmd/xcd inputs/strings/true >/dev/full'
+ atf_check -s 'exit:1' -e 'inline:\n[0mxcd: Write error: No space left on device\n' sh -c '../cmd/xcd <inputs/strings/true >/dev/full'
+ atf_check -s 'exit:1' -e 'inline:\n[0mxcd: Write error: No space left on device\n' sh -c '../cmd/xcd - <inputs/strings/true >/dev/full'
}
atf_init_test_cases() {