summaryrefslogtreecommitdiff
path: root/tests/commandtest.c
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2019-10-02 16:30:36 +0100
committerDaniel P. Berrangé <berrange@redhat.com>2019-10-14 10:54:42 +0100
commitc4d18e8b3e5c2c7304acaacf51311eba7d4b771b (patch)
tree8cebe4599e7765bd7f04e93fc76d98dd7e8369b1 /tests/commandtest.c
parent71efb59a4de7c51b1bc889a316f1796ebf55738f (diff)
downloadlibvirt-c4d18e8b3e5c2c7304acaacf51311eba7d4b771b.tar.gz
util: replace strerror/strerror_r with g_strerror
g_strerror is offers the safety/correctness benefits of strerror_r, with the API design convenience of strerror. Use of virStrerror should be eliminated through the codebase in favour of g_strerror. commandhelper.c is a special case as its a tiny single threaded test program, not linked to glib, so it just uses traditional strerror(). Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'tests/commandtest.c')
-rw-r--r--tests/commandtest.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/commandtest.c b/tests/commandtest.c
index c6fd826003..2aaddef3d1 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -636,12 +636,12 @@ static int test16(const void *unused ATTRIBUTE_UNUSED)
}
if ((fd = open(abs_builddir "/commandhelper.log",
O_CREAT | O_TRUNC | O_WRONLY, 0600)) < 0) {
- printf("Cannot open log file: %s\n", strerror(errno));
+ printf("Cannot open log file: %s\n", g_strerror(errno));
goto cleanup;
}
virCommandWriteArgLog(cmd, fd);
if (VIR_CLOSE(fd) < 0) {
- printf("Cannot close log file: %s\n", strerror(errno));
+ printf("Cannot close log file: %s\n", g_strerror(errno));
goto cleanup;
}
@@ -1116,12 +1116,12 @@ static int test26(const void *unused ATTRIBUTE_UNUSED)
}
if ((fd = open(abs_builddir "/commandhelper.log",
O_CREAT | O_TRUNC | O_WRONLY, 0600)) < 0) {
- printf("Cannot open log file: %s\n", strerror(errno));
+ printf("Cannot open log file: %s\n", g_strerror(errno));
goto cleanup;
}
virCommandWriteArgLog(cmd, fd);
if (VIR_CLOSE(fd) < 0) {
- printf("Cannot close log file: %s\n", strerror(errno));
+ printf("Cannot close log file: %s\n", g_strerror(errno));
goto cleanup;
}
@@ -1186,7 +1186,7 @@ static int test27(const void *unused ATTRIBUTE_UNUSED)
}
if (pipe(pipe1) < 0 || pipe(pipe2) < 0) {
- printf("Could not create pipe: %s\n", strerror(errno));
+ printf("Could not create pipe: %s\n", g_strerror(errno));
goto cleanup;
}