Mesa (master): util: Fix helgrind complaint about one-time init
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 24 21:24:54 UTC 2020
Module: Mesa
Branch: master
Commit: f8c7a43f33d4647c16c4892d56706a14e5d6bf17
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8c7a43f33d4647c16c4892d56706a14e5d6bf17
Author: Rob Clark <robdclark at chromium.org>
Date: Tue Nov 17 14:25:53 2020 -0800
util: Fix helgrind complaint about one-time init
Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7644>
---
src/util/u_process.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/u_process.c b/src/util/u_process.c
index 9f847d1cc02..992ed0e718d 100644
--- a/src/util/u_process.c
+++ b/src/util/u_process.c
@@ -46,6 +46,8 @@
#if defined(__linux__) && defined(HAVE_PROGRAM_INVOCATION_NAME)
+#include "debug.h"
+
static char *path = NULL;
static void __freeProgramPath()
@@ -66,7 +68,7 @@ __getProgramName()
* Strip these arguments out by using the realpath only if it was
* a prefix of the invocation name.
*/
- if (!path) {
+ do_once {
path = realpath("/proc/self/exe", NULL);
atexit(__freeProgramPath);
}
More information about the mesa-commit
mailing list