util: Fix helgrind complaint about one-time init

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7644>
This commit is contained in:
Rob Clark 2020-11-17 14:25:53 -08:00 committed by Marge Bot
parent bcb2981e14
commit f8c7a43f33

View file

@ -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);
}