aboutgitcodebugslistschat
path: root/arch.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-06-15 00:37:11 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-06-21 15:32:43 +0200
commit92a22fef93a528030669e357a32c19f143a2d3b5 (patch)
tree37d5ff28d073c0c68601a45e8f540f9da3d7d8b3 /arch.c
parentc1140df889aeb90f944c1caabdf6f73522dbb250 (diff)
downloadpasst-92a22fef93a528030669e357a32c19f143a2d3b5.tar
passt-92a22fef93a528030669e357a32c19f143a2d3b5.tar.gz
passt-92a22fef93a528030669e357a32c19f143a2d3b5.tar.bz2
passt-92a22fef93a528030669e357a32c19f143a2d3b5.tar.lz
passt-92a22fef93a528030669e357a32c19f143a2d3b5.tar.xz
passt-92a22fef93a528030669e357a32c19f143a2d3b5.tar.zst
passt-92a22fef93a528030669e357a32c19f143a2d3b5.zip
treewide: Replace perror() calls with calls to logging functions
perror() prints directly to standard error, but in many cases standard error might be already closed, or we might want to skip logging, based on configuration. Our logging functions provide all that. While at it, make errors more descriptive, replacing some of the existing basic perror-style messages. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'arch.c')
-rw-r--r--arch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch.c b/arch.c
index 80a41bc..04bebfc 100644
--- a/arch.c
+++ b/arch.c
@@ -18,6 +18,8 @@
#include <string.h>
#include <unistd.h>
+#include "log.h"
+
/**
* arch_avx2_exec() - Switch to AVX2 build if supported
* @argv: Arguments from command line
@@ -28,10 +30,8 @@ void arch_avx2_exec(char **argv)
char exe[PATH_MAX] = { 0 };
const char *p;
- if (readlink("/proc/self/exe", exe, PATH_MAX - 1) < 0) {
- perror("readlink /proc/self/exe");
- exit(EXIT_FAILURE);
- }
+ if (readlink("/proc/self/exe", exe, PATH_MAX - 1) < 0)
+ die_perror("Failed to read own /proc/self/exe link");
p = strstr(exe, ".avx2");
if (p && strlen(p) == strlen(".avx2"))
@@ -42,7 +42,7 @@ void arch_avx2_exec(char **argv)
snprintf(new_path, PATH_MAX + sizeof(".avx2"), "%s.avx2", exe);
execve(new_path, argv, environ);
- perror("Can't run AVX2 build, using non-AVX2 version");
+ warn_perror("Can't run AVX2 build, using non-AVX2 version");
}
}
#else