ports/net/freediameter/files/patch-include_freeDiameter_libfdproto.h
Alexey Dokuchaev 28fddc3efa - Update to version 1.5.0, switch to smaller .tar.bz2 distfile
- Follow NetBSD and disable SCTP for the moment which does not
  seem to fully work (tests fail with it)
2020-10-13 05:59:39 +00:00

18 lines
825 B
C

--- include/freeDiameter/libfdproto.h.orig 2020-10-10 04:58:27 UTC
+++ include/freeDiameter/libfdproto.h
@@ -292,8 +292,13 @@ extern int fd_g_debug_lvl;
/* A version of __FILE__ without the full path. This is specific to each C file being compiled */
static char * file_bname = NULL;
-static char * file_bname_init(char * full) { file_bname = basename(full); return file_bname; }
-#define __STRIPPED_FILE__ (file_bname ?: file_bname_init((char *)__FILE__))
+static char * file_bname_init(const char * full) {
+ /* Since FreeBSD 12.0, basename() modifies the provided
+ * input buffer, so we must strdup() the input string,
+ * otherwise we'd segfault on __FILE__ which is const. */
+ file_bname = basename(strdup(full));
+ return file_bname; }
+#define __STRIPPED_FILE__ (file_bname ?: file_bname_init(__FILE__))