diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/gnunet-config.c | 11 | ||||
-rw-r--r-- | src/util/gnunet-ecc.c | 11 | ||||
-rw-r--r-- | src/util/gnunet-resolver.c | 11 | ||||
-rw-r--r-- | src/util/gnunet-rsa.c | 13 | ||||
-rw-r--r-- | src/util/gnunet-uri.c | 12 | ||||
-rw-r--r-- | src/util/os_installation.c | 2 | ||||
-rw-r--r-- | src/util/test_common_logging_runtime_loglevels.c | 20 | ||||
-rw-r--r-- | src/util/test_os_start_process.c | 2 | ||||
-rw-r--r-- | src/util/test_plugin.c | 1 | ||||
-rw-r--r-- | src/util/test_resolver_api_data.conf | 1 | ||||
-rw-r--r-- | src/util/test_server_mst_interrupt.c | 37 |
11 files changed, 62 insertions, 59 deletions
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 78c93c3b8..e1aa94a5c 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -170,14 +170,15 @@ main (int argc, char *const *argv) | |||
170 | 1, &GNUNET_GETOPT_set_string, &value }, | 170 | 1, &GNUNET_GETOPT_set_string, &value }, |
171 | GNUNET_GETOPT_OPTION_END | 171 | GNUNET_GETOPT_OPTION_END |
172 | }; | 172 | }; |
173 | |||
174 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 173 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
175 | return 2; | 174 | return 2; |
176 | 175 | ||
177 | return (GNUNET_OK == | 176 | ret = (GNUNET_OK == |
178 | GNUNET_PROGRAM_run (argc, argv, "gnunet-config [OPTIONS]", | 177 | GNUNET_PROGRAM_run (argc, argv, "gnunet-config [OPTIONS]", |
179 | gettext_noop ("Manipulate GNUnet configuration files"), | 178 | gettext_noop ("Manipulate GNUnet configuration files"), |
180 | options, &run, NULL)) ? 0 : ret; | 179 | options, &run, NULL)) ? 0 : ret; |
180 | GNUNET_free ((void*) argv); | ||
181 | return ret; | ||
181 | } | 182 | } |
182 | 183 | ||
183 | /* end of gnunet-config.c */ | 184 | /* end of gnunet-config.c */ |
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index f966763a8..ad6b68a95 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c | |||
@@ -233,14 +233,17 @@ main (int argc, char *const *argv) | |||
233 | 0, &GNUNET_GETOPT_set_one, &weak_random }, | 233 | 0, &GNUNET_GETOPT_set_one, &weak_random }, |
234 | GNUNET_GETOPT_OPTION_END | 234 | GNUNET_GETOPT_OPTION_END |
235 | }; | 235 | }; |
236 | int ret; | ||
236 | 237 | ||
237 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 238 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
238 | return 2; | 239 | return 2; |
239 | 240 | ||
240 | return (GNUNET_OK == | 241 | ret = (GNUNET_OK == |
241 | GNUNET_PROGRAM_run (argc, argv, "gnunet-ecc [OPTIONS] keyfile", | 242 | GNUNET_PROGRAM_run (argc, argv, "gnunet-ecc [OPTIONS] keyfile", |
242 | gettext_noop ("Manipulate GNUnet private ECC key files"), | 243 | gettext_noop ("Manipulate GNUnet private ECC key files"), |
243 | options, &run, NULL)) ? 0 : 1; | 244 | options, &run, NULL)) ? 0 : 1; |
245 | GNUNET_free ((void*) argv); | ||
246 | return ret; | ||
244 | } | 247 | } |
245 | 248 | ||
246 | /* end of gnunet-ecc.c */ | 249 | /* end of gnunet-ecc.c */ |
diff --git a/src/util/gnunet-resolver.c b/src/util/gnunet-resolver.c index 559637748..6cb6ac564 100644 --- a/src/util/gnunet-resolver.c +++ b/src/util/gnunet-resolver.c | |||
@@ -149,14 +149,17 @@ main (int argc, char *const *argv) | |||
149 | 0, &GNUNET_GETOPT_set_one, &reverse }, | 149 | 0, &GNUNET_GETOPT_set_one, &reverse }, |
150 | GNUNET_GETOPT_OPTION_END | 150 | GNUNET_GETOPT_OPTION_END |
151 | }; | 151 | }; |
152 | int ret; | ||
152 | 153 | ||
153 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 154 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
154 | return 2; | 155 | return 2; |
155 | 156 | ||
156 | return (GNUNET_OK == | 157 | ret = (GNUNET_OK == |
157 | GNUNET_PROGRAM_run (argc, argv, "gnunet-resolver [hostname]", | 158 | GNUNET_PROGRAM_run (argc, argv, "gnunet-resolver [hostname]", |
158 | gettext_noop ("Use build-in GNUnet stub resolver"), | 159 | gettext_noop ("Use build-in GNUnet stub resolver"), |
159 | options, &run, NULL)) ? 0 : 1; | 160 | options, &run, NULL)) ? 0 : 1; |
161 | GNUNET_free ((void*) argv); | ||
162 | return ret; | ||
160 | } | 163 | } |
161 | 164 | ||
162 | /* end of gnunet-resolver.c */ | 165 | /* end of gnunet-resolver.c */ |
diff --git a/src/util/gnunet-rsa.c b/src/util/gnunet-rsa.c index d509bde67..597093ab1 100644 --- a/src/util/gnunet-rsa.c +++ b/src/util/gnunet-rsa.c | |||
@@ -222,7 +222,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
222 | * @return 0 ok, 1 on error | 222 | * @return 0 ok, 1 on error |
223 | */ | 223 | */ |
224 | int | 224 | int |
225 | main (int argc, char *const *argv) | 225 | main (int argc, char *const*argv) |
226 | { | 226 | { |
227 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 227 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
228 | { 'g', "generate-keys", "COUNT", | 228 | { 'g', "generate-keys", "COUNT", |
@@ -242,14 +242,17 @@ main (int argc, char *const *argv) | |||
242 | 0, &GNUNET_GETOPT_set_one, &weak_random }, | 242 | 0, &GNUNET_GETOPT_set_one, &weak_random }, |
243 | GNUNET_GETOPT_OPTION_END | 243 | GNUNET_GETOPT_OPTION_END |
244 | }; | 244 | }; |
245 | int ret; | ||
245 | 246 | ||
246 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 247 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
247 | return 2; | 248 | return 2; |
248 | 249 | ||
249 | return (GNUNET_OK == | 250 | ret = (GNUNET_OK == |
250 | GNUNET_PROGRAM_run (argc, argv, "gnunet-rsa [OPTIONS] keyfile", | 251 | GNUNET_PROGRAM_run (argc, argv, "gnunet-rsa [OPTIONS] keyfile", |
251 | gettext_noop ("Manipulate GNUnet private RSA key files"), | 252 | gettext_noop ("Manipulate GNUnet private RSA key files"), |
252 | options, &run, NULL)) ? 0 : 1; | 253 | options, &run, NULL)) ? 0 : 1; |
254 | GNUNET_free ((void*) argv); | ||
255 | return ret; | ||
253 | } | 256 | } |
254 | 257 | ||
255 | /* end of gnunet-rsa.c */ | 258 | /* end of gnunet-rsa.c */ |
diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c index 8cc813be5..5ca1f4efc 100644 --- a/src/util/gnunet-uri.c +++ b/src/util/gnunet-uri.c | |||
@@ -162,6 +162,7 @@ main (int argc, char *const *argv) | |||
162 | GNUNET_GETOPT_OPTION_END | 162 | GNUNET_GETOPT_OPTION_END |
163 | }; | 163 | }; |
164 | struct GNUNET_SIGNAL_Context *shc_chld; | 164 | struct GNUNET_SIGNAL_Context *shc_chld; |
165 | int ret; | ||
165 | 166 | ||
166 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 167 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
167 | return 2; | 168 | return 2; |
@@ -169,16 +170,15 @@ main (int argc, char *const *argv) | |||
169 | GNUNET_assert (sigpipe != NULL); | 170 | GNUNET_assert (sigpipe != NULL); |
170 | shc_chld = | 171 | shc_chld = |
171 | GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); | 172 | GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); |
172 | if (GNUNET_OK != | 173 | ret = GNUNET_PROGRAM_run (argc, argv, "gnunet-uri URI", |
173 | GNUNET_PROGRAM_run (argc, argv, "gnunet-uri URI", | 174 | gettext_noop ("Perform default-actions for GNUnet URIs"), |
174 | gettext_noop ("Perform default-actions for GNUnet URIs"), | 175 | options, &run, NULL); |
175 | options, &run, NULL)) | ||
176 | return 1; | ||
177 | GNUNET_SIGNAL_handler_uninstall (shc_chld); | 176 | GNUNET_SIGNAL_handler_uninstall (shc_chld); |
178 | shc_chld = NULL; | 177 | shc_chld = NULL; |
179 | GNUNET_DISK_pipe_close (sigpipe); | 178 | GNUNET_DISK_pipe_close (sigpipe); |
180 | sigpipe = NULL; | 179 | sigpipe = NULL; |
181 | return ret; | 180 | GNUNET_free ((void *) argv); |
181 | return (GNUNET_OK == ret) ? 0 : 1; | ||
182 | } | 182 | } |
183 | 183 | ||
184 | /* end of gnunet-uri.c */ | 184 | /* end of gnunet-uri.c */ |
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index 3e0efa0bf..ef3eda2ff 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -65,7 +65,7 @@ get_path_from_proc_maps () | |||
65 | while (NULL != fgets (line, sizeof (line), f)) | 65 | while (NULL != fgets (line, sizeof (line), f)) |
66 | { | 66 | { |
67 | if ((1 == | 67 | if ((1 == |
68 | SSCANF (line, "%*x-%*x %*c%*c%*c%*c %*x %*2u:%*2u %*u%*[ ]%s", dir)) && | 68 | SSCANF (line, "%*x-%*x %*c%*c%*c%*c %*x %*2u:%*2u %*u%*[ ]%1023s", dir)) && |
69 | (NULL != (lgu = strstr (dir, "libgnunetutil")))) | 69 | (NULL != (lgu = strstr (dir, "libgnunetutil")))) |
70 | { | 70 | { |
71 | lgu[0] = '\0'; | 71 | lgu[0] = '\0'; |
diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c index 4c6ae0039..7be48d0f9 100644 --- a/src/util/test_common_logging_runtime_loglevels.c +++ b/src/util/test_common_logging_runtime_loglevels.c | |||
@@ -42,6 +42,8 @@ static struct GNUNET_DISK_PipeHandle *pipe_stdout; | |||
42 | 42 | ||
43 | static GNUNET_SCHEDULER_TaskIdentifier die_task; | 43 | static GNUNET_SCHEDULER_TaskIdentifier die_task; |
44 | 44 | ||
45 | static GNUNET_SCHEDULER_TaskIdentifier read_task; | ||
46 | |||
45 | static void | 47 | static void |
46 | runone (void); | 48 | runone (void); |
47 | 49 | ||
@@ -60,6 +62,11 @@ end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
60 | GNUNET_OS_process_destroy (proc); | 62 | GNUNET_OS_process_destroy (proc); |
61 | proc = NULL; | 63 | proc = NULL; |
62 | } | 64 | } |
65 | if (GNUNET_SCHEDULER_NO_TASK != read_task) | ||
66 | { | ||
67 | GNUNET_SCHEDULER_cancel (read_task); | ||
68 | read_task = GNUNET_SCHEDULER_NO_TASK; | ||
69 | } | ||
63 | GNUNET_DISK_pipe_close (pipe_stdout); | 70 | GNUNET_DISK_pipe_close (pipe_stdout); |
64 | if (ok == 1) | 71 | if (ok == 1) |
65 | { | 72 | { |
@@ -167,6 +174,7 @@ read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
167 | long delays[8]; | 174 | long delays[8]; |
168 | int rd; | 175 | int rd; |
169 | 176 | ||
177 | read_task = GNUNET_SCHEDULER_NO_TASK; | ||
170 | rd = GNUNET_DISK_file_read (stdout_read_handle, buf_ptr, | 178 | rd = GNUNET_DISK_file_read (stdout_read_handle, buf_ptr, |
171 | sizeof (buf) - bytes); | 179 | sizeof (buf) - bytes); |
172 | if (rd > 0) | 180 | if (rd > 0) |
@@ -176,9 +184,9 @@ read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
176 | #if VERBOSE | 184 | #if VERBOSE |
177 | FPRINTF (stderr, "got %d bytes, reading more\n", rd); | 185 | FPRINTF (stderr, "got %d bytes, reading more\n", rd); |
178 | #endif | 186 | #endif |
179 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | 187 | read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
180 | stdout_read_handle, &read_call, | 188 | stdout_read_handle, &read_call, |
181 | (void *) stdout_read_handle); | 189 | stdout_read_handle); |
182 | return; | 190 | return; |
183 | } | 191 | } |
184 | 192 | ||
@@ -343,9 +351,9 @@ runone () | |||
343 | buf_ptr = buf; | 351 | buf_ptr = buf; |
344 | memset (&buf, 0, sizeof (buf)); | 352 | memset (&buf, 0, sizeof (buf)); |
345 | 353 | ||
346 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | 354 | read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
347 | stdout_read_handle, &read_call, | 355 | stdout_read_handle, &read_call, |
348 | (void *) stdout_read_handle); | 356 | stdout_read_handle); |
349 | } | 357 | } |
350 | 358 | ||
351 | static void | 359 | static void |
diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c index f732fbbdf..599451898 100644 --- a/src/util/test_os_start_process.c +++ b/src/util/test_os_start_process.c | |||
@@ -204,6 +204,7 @@ check_kill () | |||
204 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, | 204 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, |
205 | "gnunet-service-resolver", "-", NULL); | 205 | "gnunet-service-resolver", "-", NULL); |
206 | sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */ | 206 | sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */ |
207 | GNUNET_free (fn); | ||
207 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) | 208 | if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) |
208 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 209 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
209 | GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc)); | 210 | GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc)); |
@@ -241,6 +242,7 @@ check_instant_kill () | |||
241 | { | 242 | { |
242 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 243 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
243 | } | 244 | } |
245 | GNUNET_free (fn); | ||
244 | GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc)); | 246 | GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc)); |
245 | GNUNET_OS_process_destroy (proc); | 247 | GNUNET_OS_process_destroy (proc); |
246 | proc = NULL; | 248 | proc = NULL; |
diff --git a/src/util/test_plugin.c b/src/util/test_plugin.c index 122d5f480..f2abfa77d 100644 --- a/src/util/test_plugin.c +++ b/src/util/test_plugin.c | |||
@@ -35,6 +35,7 @@ test_cb (void *cls, const char *libname, void *lib_ret) | |||
35 | ret = GNUNET_PLUGIN_unload (libname, "out"); | 35 | ret = GNUNET_PLUGIN_unload (libname, "out"); |
36 | GNUNET_assert (NULL != ret); | 36 | GNUNET_assert (NULL != ret); |
37 | GNUNET_assert (0 == strcmp (ret, "World")); | 37 | GNUNET_assert (0 == strcmp (ret, "World")); |
38 | GNUNET_free (ret); | ||
38 | } | 39 | } |
39 | 40 | ||
40 | 41 | ||
diff --git a/src/util/test_resolver_api_data.conf b/src/util/test_resolver_api_data.conf index 745cb7bbe..3e264ebb7 100644 --- a/src/util/test_resolver_api_data.conf +++ b/src/util/test_resolver_api_data.conf | |||
@@ -4,5 +4,4 @@ SERVICEHOME = /tmp/test-gnunetd-statistics/ | |||
4 | [resolver] | 4 | [resolver] |
5 | PORT = 22354 | 5 | PORT = 22354 |
6 | HOSTNAME = localhost | 6 | HOSTNAME = localhost |
7 | DEBUG = YES | ||
8 | 7 | ||
diff --git a/src/util/test_server_mst_interrupt.c b/src/util/test_server_mst_interrupt.c index fd34bd00a..8fd7a2b54 100644 --- a/src/util/test_server_mst_interrupt.c +++ b/src/util/test_server_mst_interrupt.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "gnunet_time_lib.h" | 30 | #include "gnunet_time_lib.h" |
31 | 31 | ||
32 | static struct GNUNET_SERVER_MessageStreamTokenizer * mst; | 32 | static struct GNUNET_SERVER_MessageStreamTokenizer * mst; |
33 | static int ret; | 33 | |
34 | 34 | ||
35 | /* Callback destroying mst with data in buffer */ | 35 | /* Callback destroying mst with data in buffer */ |
36 | static int | 36 | static int |
@@ -42,40 +42,23 @@ mst_cb (void *cls, void *client, | |||
42 | return GNUNET_SYSERR; | 42 | return GNUNET_SYSERR; |
43 | } | 43 | } |
44 | 44 | ||
45 | /** | ||
46 | * Main method | ||
47 | */ | ||
48 | static int | ||
49 | check () | ||
50 | { | ||
51 | 45 | ||
46 | int | ||
47 | main (int argc, char *argv[]) | ||
48 | { | ||
52 | struct GNUNET_PeerIdentity id; | 49 | struct GNUNET_PeerIdentity id; |
53 | struct GNUNET_MessageHeader msg[2]; | 50 | struct GNUNET_MessageHeader msg[2]; |
54 | 51 | ||
55 | /* Prepare */ | 52 | GNUNET_log_setup ("test_server_mst_interrupt", "WARNING", NULL); |
56 | memset (&id, sizeof (id), '\0'); | 53 | memset (&id, 0, sizeof (id)); |
57 | msg[0].size = htons (sizeof (msg)); | 54 | msg[0].size = htons (sizeof (msg)); |
58 | msg[0].type = htons (sizeof (GNUNET_MESSAGE_TYPE_DUMMY)); | 55 | msg[0].type = htons (sizeof (GNUNET_MESSAGE_TYPE_DUMMY)); |
59 | |||
60 | mst = GNUNET_SERVER_mst_create(mst_cb, NULL); | 56 | mst = GNUNET_SERVER_mst_create(mst_cb, NULL); |
61 | 57 | GNUNET_SERVER_mst_receive (mst, &id, | |
62 | GNUNET_SERVER_mst_receive(mst, &id, (const char *) &msg, 2 * sizeof (msg), GNUNET_NO, GNUNET_NO); | 58 | (const char *) &msg, 2 * sizeof (msg), |
63 | 59 | GNUNET_NO, GNUNET_NO); | |
64 | /* If we reach this line, it did not crash */ | 60 | /* If we reach this line, it did not crash */ |
65 | ret = 0; | 61 | return 0; |
66 | |||
67 | return ret; | ||
68 | } | ||
69 | |||
70 | int | ||
71 | main (int argc, char *argv[]) | ||
72 | { | ||
73 | ret = 1; | ||
74 | |||
75 | GNUNET_log_setup ("test_server", "WARNING", NULL); | ||
76 | check (); | ||
77 | |||
78 | return ret; | ||
79 | } | 62 | } |
80 | 63 | ||
81 | /* end of test_server_mst_interrupt.c */ | 64 | /* end of test_server_mst_interrupt.c */ |