summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2013-10-18 17:05:53 (GMT)
committerWaldemar Brodkorb <wbx@openadk.org>2013-10-18 17:05:53 (GMT)
commit53f5d329a01a8b09658423009837c146759bce2d (patch)
tree8519ac4c7300866ca02afe3950c72230af4a3285 /tools
parent31323a968bbc276e3edf29af7137741be79810f4 (diff)
man page of strdup says it: These functions modify their first argument., fix multiple PKG_{HOST,SYSTEM,LIBC,ARCH}_DEPENDS for subpackages
Diffstat (limited to 'tools')
-rw-r--r--tools/adk/pkgmaker.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/tools/adk/pkgmaker.c b/tools/adk/pkgmaker.c
index e83c581..2be187a 100644
--- a/tools/adk/pkgmaker.c
+++ b/tools/adk/pkgmaker.c
@@ -273,7 +273,7 @@ int main() {
char *pkg_need_cxx, *pkg_need_java, *pkgname;
char *pkg_libc_depends, *pkg_host_depends, *pkg_system_depends, *pkg_arch_depends, *pkg_flavours, *pkg_flavours_string, *pkg_choices, *pseudo_name;
char *packages, *pkg_name_u, *pkgs;
- char *saveptr, *p_ptr, *s_ptr;
+ char *saveptr, *p_ptr, *s_ptr, *pkg_helper;
int result;
StrMap *pkgmap, *sectionmap;
@@ -297,6 +297,7 @@ int main() {
pkg_need_cxx = NULL;
pkg_need_java = NULL;
pkgname = NULL;
+ pkg_helper = NULL;
p_ptr = NULL;
s_ptr = NULL;
@@ -617,7 +618,8 @@ int main() {
/* create package target system dependency information */
if (pkg_system_depends != NULL) {
- token = strtok(pkg_system_depends, " ");
+ pkg_helper = strdup(pkg_system_depends);
+ token = strtok(pkg_helper, " ");
fprintf(cfg, "\tdepends on ");
sp = "";
while (token != NULL) {
@@ -631,10 +633,13 @@ int main() {
token = strtok(NULL, " ");
}
fprintf(cfg, "\n");
+ free(pkg_helper);
+ pkg_helper = NULL;
}
/* create package host dependency information */
if (pkg_host_depends != NULL) {
- token = strtok(pkg_host_depends, " ");
+ pkg_helper = strdup(pkg_host_depends);
+ token = strtok(pkg_helper, " ");
fprintf(cfg, "\tdepends on ");
sp = "";
while (token != NULL) {
@@ -648,11 +653,14 @@ int main() {
token = strtok(NULL, " ");
}
fprintf(cfg, "\n");
+ free(pkg_helper);
+ pkg_helper = NULL;
}
/* create package libc dependency information */
if (pkg_libc_depends != NULL) {
- token = strtok(pkg_libc_depends, " ");
+ pkg_helper = strdup(pkg_libc_depends);
+ token = strtok(pkg_helper, " ");
fprintf(cfg, "\tdepends on ");
sp = "";
while (token != NULL) {
@@ -666,10 +674,13 @@ int main() {
token = strtok(NULL, " ");
}
fprintf(cfg, "\n");
+ free(pkg_helper);
+ pkg_helper = NULL;
}
/* create package target architecture dependency information */
if (pkg_arch_depends != NULL) {
- token = strtok(pkg_arch_depends, " ");
+ pkg_helper = strdup(pkg_arch_depends);
+ token = strtok(pkg_helper, " ");
fprintf(cfg, "\tdepends on ");
sp = "";
while (token != NULL) {
@@ -683,6 +694,8 @@ int main() {
token = strtok(NULL, " ");
}
fprintf(cfg, "\n");
+ free(pkg_helper);
+ pkg_helper = NULL;
}
/* create package dependency information */