From 4da9c04a761db6bf183ef3b9c3a687e665ea92cf Mon Sep 17 00:00:00 2001 From: John Levon Date: Thu, 14 May 2020 15:08:25 +0000 Subject: [PATCH 1/2] Makefile fixes for passing PATH and CC Allow users to pass in CC and CFLAGS arguments. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 71a9dbe..0c4403e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -CC = gcc -CFLAGS = -O2 -Wall +CC := gcc +CFLAGS := -O2 -Wall # MAC_BUILD - set this to "universal" to build a 2-way fat library MAC_BUILD = universal @@ -20,7 +20,7 @@ endif ifeq ($(UNAME), SunOS) RANLIB=/bin/true -PATH +=:/usr/perl5/5.10.0/bin:/usr/perl5/5.12/bin +PATH := $(PATH):/usr/perl5/5.10.0/bin:/usr/perl5/5.12/bin CFLAGS += -fPIC ifeq ($(ARCH), i86pc) ARCH = $(shell isainfo -k) From e958096e23799a3851c7711bfc989721cb92c29b Mon Sep 17 00:00:00 2001 From: John Levon Date: Thu, 14 May 2020 15:11:01 +0000 Subject: [PATCH 2/2] Fix strncpy() in usdt_dof_file_load() GCC 9 correctly points out: usdt_dof_file.c:187:16: warning: 'strncpy' specified bound 64 equals destination size [-Wstringop-truncation] 187 | (void) strncpy(dh.dofhp_mod, module, sizeof (dh.dofhp_mod)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- usdt_dof_file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usdt_dof_file.c b/usdt_dof_file.c index 1c0b4f8..108c1d3 100644 --- a/usdt_dof_file.c +++ b/usdt_dof_file.c @@ -184,7 +184,8 @@ usdt_dof_file_load(usdt_dof_file_t *file, const char *module) #if __FreeBSD__ >= 11 dh.dofhp_pid = getpid(); #endif - (void) strncpy(dh.dofhp_mod, module, sizeof (dh.dofhp_mod)); + (void) strncpy(dh.dofhp_mod, module, sizeof (dh.dofhp_mod) - 1); + dh.dofhp_mod[sizeof (dh.dofhp_mod) - 1] = '\0'; if ((fd = open(helper, O_RDWR)) < 0) return (-1);