aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_group.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_group.c')
-rw-r--r--src/testing/testing_group.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index 4c123a980..4b34a21de 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -1937,7 +1937,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
1937 FILE *temp_friend_handle; 1937 FILE *temp_friend_handle;
1938 unsigned int pg_iter; 1938 unsigned int pg_iter;
1939 char *temp_service_path; 1939 char *temp_service_path;
1940 pid_t *pidarr; 1940 GNUNET_OS_Process **procarr;
1941 char *arg; 1941 char *arg;
1942 char * mytemp; 1942 char * mytemp;
1943 enum GNUNET_OS_ProcessStatusType type; 1943 enum GNUNET_OS_ProcessStatusType type;
@@ -1946,7 +1946,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
1946 int ret; 1946 int ret;
1947 int max_wait = 10; 1947 int max_wait = 10;
1948 1948
1949 pidarr = GNUNET_malloc(sizeof(pid_t) * pg->total); 1949 procarr = GNUNET_malloc(sizeof(GNUNET_OS_Process *) * pg->total);
1950 for (pg_iter = 0; pg_iter < pg->total; pg_iter++) 1950 for (pg_iter = 0; pg_iter < pg->total; pg_iter++)
1951 { 1951 {
1952 mytemp = GNUNET_DISK_mktemp("friends"); 1952 mytemp = GNUNET_DISK_mktemp("friends");
@@ -1972,7 +1972,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
1972 if (pg->peers[pg_iter].daemon->hostname == NULL) /* Local, just copy the file */ 1972 if (pg->peers[pg_iter].daemon->hostname == NULL) /* Local, just copy the file */
1973 { 1973 {
1974 GNUNET_asprintf (&arg, "%s/friends", temp_service_path); 1974 GNUNET_asprintf (&arg, "%s/friends", temp_service_path);
1975 pidarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "mv", 1975 procarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "mv",
1976 "mv", mytemp, arg, NULL); 1976 "mv", mytemp, arg, NULL);
1977#if VERBOSE_TESTING 1977#if VERBOSE_TESTING
1978 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1978 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1987,7 +1987,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
1987 GNUNET_asprintf (&arg, "%s@%s:%s/friends", pg->peers[pg_iter].daemon->username, pg->peers[pg_iter].daemon->hostname, temp_service_path); 1987 GNUNET_asprintf (&arg, "%s@%s:%s/friends", pg->peers[pg_iter].daemon->username, pg->peers[pg_iter].daemon->hostname, temp_service_path);
1988 else 1988 else
1989 GNUNET_asprintf (&arg, "%s:%s/friends", pg->peers[pg_iter].daemon->hostname, temp_service_path); 1989 GNUNET_asprintf (&arg, "%s:%s/friends", pg->peers[pg_iter].daemon->hostname, temp_service_path);
1990 pidarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "scp", 1990 procarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "scp",
1991 "scp", mytemp, arg, NULL); 1991 "scp", mytemp, arg, NULL);
1992 1992
1993#if VERBOSE_TESTING 1993#if VERBOSE_TESTING
@@ -2011,9 +2011,9 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
2011 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2011 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2012 _("Checking copy status of file %d\n"), pg_iter); 2012 _("Checking copy status of file %d\n"), pg_iter);
2013#endif 2013#endif
2014 if (pidarr[pg_iter] != 0) /* Check for already completed! */ 2014 if (procarr[pg_iter] != NULL) /* Check for already completed! */
2015 { 2015 {
2016 if (GNUNET_OS_process_status(pidarr[pg_iter], &type, &return_code) != GNUNET_OK) 2016 if (GNUNET_OS_process_status(procarr[pg_iter], &type, &return_code) != GNUNET_OK)
2017 { 2017 {
2018 ret = GNUNET_SYSERR; 2018 ret = GNUNET_SYSERR;
2019 } 2019 }
@@ -2023,7 +2023,8 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
2023 } 2023 }
2024 else 2024 else
2025 { 2025 {
2026 pidarr[pg_iter] = 0; 2026 GNUNET_OS_process_close (procarr[pg_iter]);
2027 procarr[pg_iter] = NULL;
2027#if VERBOSE_TESTING 2028#if VERBOSE_TESTING
2028 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2029 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2029 _("File %d copied\n"), pg_iter); 2030 _("File %d copied\n"), pg_iter);
@@ -2043,7 +2044,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
2043 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2044 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2044 _("Finished copying all friend files!\n")); 2045 _("Finished copying all friend files!\n"));
2045#endif 2046#endif
2046 GNUNET_free(pidarr); 2047 GNUNET_free(procarr);
2047 return ret; 2048 return ret;
2048} 2049}
2049 2050
@@ -2063,7 +2064,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char
2063 static struct BlacklistContext blacklist_ctx; 2064 static struct BlacklistContext blacklist_ctx;
2064 unsigned int pg_iter; 2065 unsigned int pg_iter;
2065 char *temp_service_path; 2066 char *temp_service_path;
2066 pid_t *pidarr; 2067 GNUNET_OS_Process **procarr;
2067 char *arg; 2068 char *arg;
2068 char *mytemp; 2069 char *mytemp;
2069 enum GNUNET_OS_ProcessStatusType type; 2070 enum GNUNET_OS_ProcessStatusType type;
@@ -2076,7 +2077,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char
2076 char *pos; 2077 char *pos;
2077 char *temp_transports; 2078 char *temp_transports;
2078 2079
2079 pidarr = GNUNET_malloc(sizeof(pid_t) * pg->total); 2080 procarr = GNUNET_malloc(sizeof(GNUNET_OS_Process *) * pg->total);
2080 for (pg_iter = 0; pg_iter < pg->total; pg_iter++) 2081 for (pg_iter = 0; pg_iter < pg->total; pg_iter++)
2081 { 2082 {
2082 mytemp = GNUNET_DISK_mktemp("blacklist"); 2083 mytemp = GNUNET_DISK_mktemp("blacklist");
@@ -2124,7 +2125,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char
2124 if (pg->peers[pg_iter].daemon->hostname == NULL) /* Local, just copy the file */ 2125 if (pg->peers[pg_iter].daemon->hostname == NULL) /* Local, just copy the file */
2125 { 2126 {
2126 GNUNET_asprintf (&arg, "%s/blacklist", temp_service_path); 2127 GNUNET_asprintf (&arg, "%s/blacklist", temp_service_path);
2127 pidarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "mv", 2128 procarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "mv",
2128 "mv", mytemp, arg, NULL); 2129 "mv", mytemp, arg, NULL);
2129#if VERBOSE_TESTING 2130#if VERBOSE_TESTING
2130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2131 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2139,7 +2140,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char
2139 GNUNET_asprintf (&arg, "%s@%s:%s/blacklist", pg->peers[pg_iter].daemon->username, pg->peers[pg_iter].daemon->hostname, temp_service_path); 2140 GNUNET_asprintf (&arg, "%s@%s:%s/blacklist", pg->peers[pg_iter].daemon->username, pg->peers[pg_iter].daemon->hostname, temp_service_path);
2140 else 2141 else
2141 GNUNET_asprintf (&arg, "%s:%s/blacklist", pg->peers[pg_iter].daemon->hostname, temp_service_path); 2142 GNUNET_asprintf (&arg, "%s:%s/blacklist", pg->peers[pg_iter].daemon->hostname, temp_service_path);
2142 pidarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "scp", 2143 procarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "scp",
2143 "scp", mytemp, arg, NULL); 2144 "scp", mytemp, arg, NULL);
2144 2145
2145#if VERBOSE_TESTING 2146#if VERBOSE_TESTING
@@ -2163,9 +2164,9 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char
2163 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2164 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2164 _("Checking copy status of file %d\n"), pg_iter); 2165 _("Checking copy status of file %d\n"), pg_iter);
2165#endif 2166#endif
2166 if (pidarr[pg_iter] != 0) /* Check for already completed! */ 2167 if (procarr[pg_iter] != NULL) /* Check for already completed! */
2167 { 2168 {
2168 if (GNUNET_OS_process_status(pidarr[pg_iter], &type, &return_code) != GNUNET_OK) 2169 if (GNUNET_OS_process_status(procarr[pg_iter], &type, &return_code) != GNUNET_OK)
2169 { 2170 {
2170 ret = GNUNET_SYSERR; 2171 ret = GNUNET_SYSERR;
2171 } 2172 }
@@ -2175,7 +2176,8 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char
2175 } 2176 }
2176 else 2177 else
2177 { 2178 {
2178 pidarr[pg_iter] = 0; 2179 GNUNET_OS_process_close (procarr[pg_iter]);
2180 procarr[pg_iter] = NULL;
2179#if VERBOSE_TESTING 2181#if VERBOSE_TESTING
2180 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2182 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2181 _("File %d copied\n"), pg_iter); 2183 _("File %d copied\n"), pg_iter);
@@ -2195,7 +2197,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char
2195 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2197 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2196 _("Finished copying all blacklist files!\n")); 2198 _("Finished copying all blacklist files!\n"));
2197#endif 2199#endif
2198 GNUNET_free(pidarr); 2200 GNUNET_free(procarr);
2199 return ret; 2201 return ret;
2200} 2202}
2201 2203