From: Christian Brauner Date: Thu, 22 Apr 2021 09:00:09 +0000 (+0200) Subject: Makefile: fix strchrnul() inclusion X-Git-Tag: lxc-5.0.0~196^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3803%2Fhead;p=thirdparty%2Flxc.git Makefile: fix strchrnul() inclusion Signed-off-by: Christian Brauner --- diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am index c8aa87b8f..7ead4e270 100644 --- a/src/lxc/Makefile.am +++ b/src/lxc/Makefile.am @@ -20,6 +20,7 @@ noinst_HEADERS = api_extensions.h \ error.h \ error_utils.h \ file_utils.h \ + ../include/strchrnul.h \ ../include/netns_ifaddrs.h \ initutils.h \ list.h \ @@ -391,6 +392,10 @@ lxc_attach_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_attach_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_attach_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_autostart_SOURCES = tools/lxc_autostart.c \ @@ -448,6 +453,10 @@ lxc_autostart_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_autostart_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_autostart_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_cgroup_SOURCES = tools/lxc_cgroup.c \ @@ -505,6 +514,10 @@ lxc_cgroup_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_cgroup_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_cgroup_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_config_SOURCES = tools/lxc_config.c \ @@ -562,6 +575,10 @@ lxc_config_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_config_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_config_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_console_SOURCES = tools/lxc_console.c \ @@ -619,6 +636,10 @@ lxc_console_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_console_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_console_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_destroy_SOURCES = tools/lxc_destroy.c \ @@ -676,6 +697,10 @@ lxc_destroy_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_destroy_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_destroy_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_device_SOURCES = tools/lxc_device.c \ @@ -733,6 +758,10 @@ lxc_device_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_device_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_device_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_execute_SOURCES = tools/lxc_execute.c \ @@ -790,6 +819,10 @@ lxc_execute_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_execute_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_execute_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_freeze_SOURCES = tools/lxc_freeze.c \ @@ -847,6 +880,10 @@ lxc_freeze_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_freeze_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_freeze_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_info_SOURCES = tools/lxc_info.c \ @@ -904,6 +941,10 @@ lxc_info_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_info_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_info_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_monitor_SOURCES = tools/lxc_monitor.c \ @@ -962,6 +1003,10 @@ lxc_monitor_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_monitor_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_monitor_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_ls_SOURCES = tools/lxc_ls.c \ @@ -1020,6 +1065,10 @@ lxc_ls_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_ls_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_ls_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_copy_SOURCES = tools/lxc_copy.c \ @@ -1077,6 +1126,10 @@ lxc_copy_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_copy_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_copy_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_start_SOURCES = tools/lxc_start.c \ @@ -1134,6 +1187,10 @@ lxc_start_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_start_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_start_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_stop_SOURCES = tools/lxc_stop.c \ @@ -1191,6 +1248,10 @@ lxc_stop_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_stop_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_stop_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_top_SOURCES = tools/lxc_top.c \ @@ -1248,6 +1309,10 @@ lxc_top_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_top_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_top_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_unfreeze_SOURCES = tools/lxc_unfreeze.c \ @@ -1305,6 +1370,10 @@ lxc_unfreeze_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_unfreeze_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_unfreeze_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_unshare_SOURCES = tools/lxc_unshare.c \ @@ -1364,6 +1433,10 @@ lxc_unshare_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_unshare_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_unshare_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_wait_SOURCES = tools/lxc_wait.c \ @@ -1421,6 +1494,10 @@ lxc_wait_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_wait_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_wait_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_create_SOURCES = tools/lxc_create.c \ @@ -1478,6 +1555,10 @@ lxc_create_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_create_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_create_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_snapshot_SOURCES = tools/lxc_snapshot.c \ @@ -1535,6 +1616,10 @@ lxc_snapshot_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_snapshot_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_snapshot_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_checkpoint_SOURCES = tools/lxc_checkpoint.c \ @@ -1592,6 +1677,11 @@ lxc_checkpoint_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_checkpoint_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_checkpoint_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + endif endif @@ -1665,6 +1755,10 @@ lxc_monitord_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_monitord_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_monitord_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_user_nic_SOURCES = cmd/lxc_user_nic.c @@ -1724,6 +1818,10 @@ lxc_user_nic_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_user_nic_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_user_nic_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c @@ -1784,6 +1882,10 @@ lxc_usernsexec_SOURCES += af_unix.c af_unix.h \ if ENABLE_SECCOMP lxc_usernsexec_SOURCES += seccomp.c lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_usernsexec_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif endif endif diff --git a/src/lxc/tools/include/getsubopt.c b/src/lxc/tools/include/getsubopt.c index d4481f736..1cc4080b9 100644 --- a/src/lxc/tools/include/getsubopt.c +++ b/src/lxc/tools/include/getsubopt.c @@ -4,19 +4,11 @@ #include #include -char *strchrnul(const char *s, int c) -{ - char *result; - - result = strchr( s, c ); +#include "config.h" - if( !result ) - { - result = (char *)s + strlen( s ); - } - - return( result ); -} +#ifndef HAVE_STRCHRNUL +#include "include/strchrnul" +#endif /* Parse comma separated suboption from *OPTIONP and match against strings in TOKENS. If found return index and set *VALUEP to diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 13ca512f6..69e80d751 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -69,6 +69,10 @@ if ENABLE_SECCOMP lxc_test_api_reboot_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif +if !HAVE_STRCHRNUL +lxc_test_api_reboot_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_apparmor_SOURCES = aa.c \ ../lxc/af_unix.c ../lxc/af_unix.h \ ../lxc/caps.c ../lxc/caps.h \ @@ -119,6 +123,10 @@ if ENABLE_SECCOMP lxc_test_apparmor_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif +if !HAVE_STRCHRNUL +lxc_test_apparmor_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_attach_SOURCES = attach.c \ ../lxc/af_unix.c ../lxc/af_unix.h \ ../lxc/caps.c ../lxc/caps.h \ @@ -169,6 +177,10 @@ if ENABLE_SECCOMP lxc_test_attach_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif +if !HAVE_STRCHRNUL +lxc_test_attach_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_basic_SOURCES = basic.c lxc_test_cgpath_SOURCES = cgpath.c \ ../lxc/af_unix.c ../lxc/af_unix.h \ @@ -220,6 +232,10 @@ if ENABLE_SECCOMP lxc_test_cgpath_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif +if !HAVE_STRCHRNUL +lxc_test_cgpath_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_clonetest_SOURCES = clonetest.c lxc_test_concurrent_SOURCES = concurrent.c lxc_test_config_jump_table_SOURCES = config_jump_table.c \ @@ -273,6 +289,10 @@ if ENABLE_SECCOMP lxc_test_config_jump_table_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif +if !HAVE_STRCHRNUL +lxc_test_config_jump_table_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_console_SOURCES = console.c lxc_test_console_log_SOURCES = console_log.c lxctest.h lxc_test_containertests_SOURCES = containertests.c @@ -329,6 +349,11 @@ lxc_test_device_add_remove_SOURCES = device_add_remove.c \ if ENABLE_SECCOMP lxc_test_device_add_remove_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_test_device_add_remove_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_getkeys_SOURCES = getkeys.c lxc_test_get_item_SOURCES = get_item.c \ ../lxc/af_unix.c ../lxc/af_unix.h \ @@ -379,6 +404,11 @@ lxc_test_get_item_SOURCES = get_item.c \ if ENABLE_SECCOMP lxc_test_get_item_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif + +if !HAVE_STRCHRNUL +lxc_test_get_item_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_list_SOURCES = list.c lxc_test_locktests_SOURCES = locktests.c \ ../lxc/af_unix.c ../lxc/af_unix.h \ @@ -430,6 +460,10 @@ if ENABLE_SECCOMP lxc_test_locktests_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif +if !HAVE_STRCHRNUL +lxc_test_locktests_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_lxcpath_SOURCES = lxcpath.c lxc_test_may_control_SOURCES = may_control.c lxc_test_mount_injection_SOURCES = mount_injection.c \ @@ -483,6 +517,10 @@ if ENABLE_SECCOMP lxc_test_mount_injection_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif +if !HAVE_STRCHRNUL +lxc_test_mount_injection_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_parse_config_file_SOURCES = parse_config_file.c \ lxctest.h \ ../lxc/af_unix.c ../lxc/af_unix.h \ @@ -534,6 +572,10 @@ if ENABLE_SECCOMP lxc_test_parse_config_file_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif +if !HAVE_STRCHRNUL +lxc_test_parse_config_file_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_raw_clone_SOURCES = lxc_raw_clone.c \ lxctest.h \ ../lxc/af_unix.c ../lxc/af_unix.h \ @@ -585,6 +627,10 @@ if ENABLE_SECCOMP lxc_test_raw_clone_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif +if !HAVE_STRCHRNUL +lxc_test_raw_clone_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + lxc_test_reboot_SOURCES = reboot.c lxc_test_saveconfig_SOURCES = saveconfig.c lxc_test_share_ns_SOURCES = share_ns.c \ @@ -650,6 +696,10 @@ if ENABLE_SECCOMP lxc_test_utils_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif +if !HAVE_STRCHRNUL +lxc_test_utils_SOURCES += ../include/strchrnul.c ../include/strchrnul.h +endif + AM_CFLAGS += -DLXCROOTFSMOUNT=\"$(LXCROOTFSMOUNT)\" \ -DLXCPATH=\"$(LXCPATH)\" \ -DLXC_GLOBAL_CONF=\"$(LXC_GLOBAL_CONF)\" \