aboutsummaryrefslogtreecommitdiff
path: root/src/arm/do_start_process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arm/do_start_process.c')
-rw-r--r--src/arm/do_start_process.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/arm/do_start_process.c b/src/arm/do_start_process.c
index f4d3424ff..fd7fc17ed 100644
--- a/src/arm/do_start_process.c
+++ b/src/arm/do_start_process.c
@@ -10,10 +10,10 @@
10 * @param lsocks array of listen sockets to dup starting at fd3 (systemd-style), or NULL 10 * @param lsocks array of listen sockets to dup starting at fd3 (systemd-style), or NULL
11 * @param first_arg first argument for argv (may be an empty string) 11 * @param first_arg first argument for argv (may be an empty string)
12 * @param ... more arguments, NULL terminated 12 * @param ... more arguments, NULL terminated
13 * @return PID of the started process, -1 on error 13 * @return handle of the started process, NULL on error
14 */ 14 */
15static struct GNUNET_OS_Process * 15static struct GNUNET_OS_Process *
16do_start_process (const SOCKTYPE *lsocks, const char *first_arg, ...) 16do_start_process (const SOCKTYPE * lsocks, const char *first_arg, ...)
17{ 17{
18 va_list ap; 18 va_list ap;
19 char **argv; 19 char **argv;
@@ -35,20 +35,20 @@ do_start_process (const SOCKTYPE *lsocks, const char *first_arg, ...)
35/* *INDENT-ON* */ 35/* *INDENT-ON* */
36 rpos = arg; 36 rpos = arg;
37 while ('\0' != *rpos) 37 while ('\0' != *rpos)
38 {
39 if (' ' == *rpos)
40 { 38 {
41 if (last != NULL) 39 if (' ' == *rpos)
42 argv_size++; 40 {
43 last = NULL; 41 if (last != NULL)
44 while (' ' == *rpos) 42 argv_size++;
45 rpos++; 43 last = NULL;
44 while (' ' == *rpos)
45 rpos++;
46 }
47 if ((last == NULL) && (*rpos != '\0'))
48 last = rpos;
49 if (*rpos != '\0')
50 rpos++;
46 } 51 }
47 if ((last == NULL) && (*rpos != '\0'))
48 last = rpos;
49 if (*rpos != '\0')
50 rpos++;
51 }
52 if (last != NULL) 52 if (last != NULL)
53 argv_size++; 53 argv_size++;
54/* *INDENT-OFF* */ 54/* *INDENT-OFF* */
@@ -69,22 +69,22 @@ do_start_process (const SOCKTYPE *lsocks, const char *first_arg, ...)
69 cp = GNUNET_strdup (arg); 69 cp = GNUNET_strdup (arg);
70 pos = cp; 70 pos = cp;
71 while ('\0' != *pos) 71 while ('\0' != *pos)
72 {
73 if (' ' == *pos)
74 { 72 {
75 *pos = '\0'; 73 if (' ' == *pos)
76 if (last != NULL) 74 {
77 argv[argv_size++] = GNUNET_strdup (last); 75 *pos = '\0';
78 last = NULL; 76 if (last != NULL)
79 pos++; 77 argv[argv_size++] = GNUNET_strdup (last);
80 while (' ' == *pos) 78 last = NULL;
81 pos++; 79 pos++;
80 while (' ' == *pos)
81 pos++;
82 }
83 if ((last == NULL) && (*pos != '\0'))
84 last = pos;
85 if (*pos != '\0')
86 pos++;
82 } 87 }
83 if ((last == NULL) && (*pos != '\0'))
84 last = pos;
85 if (*pos != '\0')
86 pos++;
87 }
88 if (last != NULL) 88 if (last != NULL)
89 argv[argv_size++] = GNUNET_strdup (last); 89 argv[argv_size++] = GNUNET_strdup (last);
90 last = NULL; 90 last = NULL;