summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.c24
-rw-r--r--src/util/string.c2
2 files changed, 18 insertions, 8 deletions
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;