Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add getprogname() compatibility fallback for Linux GLibc
Alex Richardson committed 5 years ago
commit 4c110d7691b35d3d07824337773439202174fc6d
parent 338a136
2 files changed +10 -1
modified auto.def
@@ -156,7 +156,7 @@ cc-check-includes stdint.h inttypes.h

# check for pkg itself
cc-check-functions arc4random arc4random_stir basename_r chflagsat \
-
	closefrom dirfd eaccess fopencookie fstatfs funopen strnstr \
+
	closefrom dirfd eaccess fopencookie fstatfs funopen getprogname strnstr \
	strtofflags strtonum sysconf utimensat __res_setservers unlinkat \
	faccessat fstatat openat readlinkat fflagstostr reallocarray strchrnul

modified compat/bsd_compat.h
@@ -174,4 +174,13 @@ FILE * funopen(const void *cookie, int (*readfn)(void *, char *, int),
         off_t (*seekfn)(void *, off_t, int), int (*closefn)(void *));
#endif

+
#if !HAVE_GETPROGNAME
+
#ifdef __GLIBC__
+
extern char *program_invocation_short_name;
+
# define getprogname() program_invocation_short_name
+
#else
+
# error "Don't know how to replace getprogname()"
+
#endif
+
#endif
+

#endif