Skip to content

Commit 6cb21b8

Browse files
committed
perflib/err.c: use program_invocation_name on glibc
Signed-off-by: Eugene Syromiatnikov <[email protected]>
1 parent 8ed3e85 commit 6cb21b8

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

source/perflib/err.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,25 @@
1313

1414
const char *progname;
1515

16+
static ossl_inline void *
17+
get_progname(void)
18+
{
19+
if (progname != NULL)
20+
return progname;
21+
22+
#if defined(__GLIBC__)
23+
if (program_invocation_name && program_invocation_name[0])
24+
return program_invocation_name;
25+
#endif
26+
27+
return NULL;
28+
}
29+
1630
void
1731
vwarnx(const char *fmt, va_list ap)
1832
{
19-
if (progname != NULL)
20-
fprintf(stderr, "%s: ", progname);
33+
if (get_progname() != NULL)
34+
fprintf(stderr, "%s: ", get_progname());
2135
vfprintf(stderr, fmt, ap);
2236
putc('\n', stderr);
2337
}

0 commit comments

Comments
 (0)