aboutgitcodebugslistschat
path: root/arch.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-09-28 14:33:19 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-09-29 12:22:01 +0200
commiteb5e1230386ce2eafa2ef1770bb5ffd3e918fdc6 (patch)
treea128ae0781a1f43d38396285fa080cdbd3d02ff7 /arch.c
parent68ef4931cb8bcbc53c0d2b6078946d836da7b5d9 (diff)
downloadpasst-eb5e1230386ce2eafa2ef1770bb5ffd3e918fdc6.tar
passt-eb5e1230386ce2eafa2ef1770bb5ffd3e918fdc6.tar.gz
passt-eb5e1230386ce2eafa2ef1770bb5ffd3e918fdc6.tar.bz2
passt-eb5e1230386ce2eafa2ef1770bb5ffd3e918fdc6.tar.lz
passt-eb5e1230386ce2eafa2ef1770bb5ffd3e918fdc6.tar.xz
passt-eb5e1230386ce2eafa2ef1770bb5ffd3e918fdc6.tar.zst
passt-eb5e1230386ce2eafa2ef1770bb5ffd3e918fdc6.zip
cppcheck: Reduce scope of some variables
Minor style improvement suggested by cppcheck. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'arch.c')
-rw-r--r--arch.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch.c b/arch.c
index 10eb24a..a2c4562 100644
--- a/arch.c
+++ b/arch.c
@@ -25,7 +25,7 @@
#ifdef __x86_64__
void arch_avx2_exec(char **argv)
{
- char exe[PATH_MAX] = { 0 }, new_path[PATH_MAX + sizeof(".avx2")], *p;
+ char exe[PATH_MAX] = { 0 }, *p;
if (readlink("/proc/self/exe", exe, PATH_MAX - 1) < 0) {
perror("readlink /proc/self/exe");
@@ -37,6 +37,8 @@ void arch_avx2_exec(char **argv)
return;
if (__builtin_cpu_supports("avx2")) {
+ char new_path[PATH_MAX + sizeof(".avx2")];
+
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");