summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Camera <skonfig@dtnr.ch>2022-08-17 23:54:40 +0200
committerDennis Camera <skonfig@dtnr.ch>2022-08-17 23:54:40 +0200
commitcc238bc2307241a9c27a29a1b159605c72bec775 (patch)
tree316bc3924228101d89d49413b0f1b9abc902d10d
parent3c0da35d1eeacb150c91e156892d17e1204b19d0 (diff)
downloadskonfig-c-cc238bc2307241a9c27a29a1b159605c72bec775.tar.gz
skonfig-c-cc238bc2307241a9c27a29a1b159605c72bec775.zip
Misc
-rw-r--r--configure.ac2
-rw-r--r--src/config.c24
-rw-r--r--src/util/string.c2
3 files changed, 20 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 546b6ec..26f7535 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,8 @@ AC_PROG_CC
# autoconf 2.70 obsoletes AC_PROG_CC_C99 and includes it in AC_PROG_CC
m4_version_prereq([2.70],[],[AC_PROG_CC_C99])
+AC_PROG_CPP
+AC_PROG_MAKE_SET
# Checks for libraries.
# Checks for header files.
diff --git a/src/config.c b/src/config.c
index a042102..bc7c28b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -97,14 +97,22 @@ struct sk_config *sk_config_alloc() {
void sk_config_cpy(struct sk_config *restrict dest, const struct sk_config *restrict src) {
memcpy(dest, src, sizeof(struct sk_config));
- dest->global.local_shell = strdup(src->global.local_shell);
- dest->global.remote_shell = strdup(src->global.remote_shell);
- dest->global.cache_path_pattern = strdup(src->global.cache_path_pattern);
- dest->global.init_manifest = strdup(src->global.init_manifest);
- dest->global.out_path = strdup(src->global.out_path);
- dest->global.remote_out_path = strdup(src->global.remote_out_path);
- dest->global.remote_exec = strdup(src->global.remote_exec);
- dest->global.inventory_dir = strdup(src->global.inventory_dir);
+ if (NULL != src->global.local_shell)
+ dest->global.local_shell = strdup(src->global.local_shell);
+ if (NULL != src->global.remote_shell)
+ dest->global.remote_shell = strdup(src->global.remote_shell);
+ if (NULL != src->global.cache_path_pattern)
+ dest->global.cache_path_pattern = strdup(src->global.cache_path_pattern);
+ if (NULL != src->global.init_manifest)
+ dest->global.init_manifest = strdup(src->global.init_manifest);
+ if (NULL != src->global.out_path)
+ dest->global.out_path = strdup(src->global.out_path);
+ if (NULL != src->global.remote_out_path)
+ dest->global.remote_out_path = strdup(src->global.remote_out_path);
+ if (NULL != src->global.remote_exec)
+ dest->global.remote_exec = strdup(src->global.remote_exec);
+ if (NULL != src->global.inventory_dir)
+ dest->global.inventory_dir = strdup(src->global.inventory_dir);
if (src->global.conf_dir) {
size_t last = 0;
diff --git a/src/util/string.c b/src/util/string.c
index db565c0..2b24f4e 100644
--- a/src/util/string.c
+++ b/src/util/string.c
@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <string.h>
+#ifndef HAVE_STRDUP
char *strdup(const char *s) {
if (NULL == s) {
return NULL;
@@ -17,6 +18,7 @@ char *strdup(const char *s) {
}
return buf;
}
+#endif
char *stranjoin(char sep, const char *a[], size_t nmemb) {
char *dst;