diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-30 22:43:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-30 22:43:52 +0000 |
commit | f5a017ed63ee50feeefc6f0c2b28549aeca92ded (patch) | |
tree | efb619e68756960821ff3ad667a1452db9add7f7 /src | |
parent | 416c2f5a713b93ba689a8cd1e038682a53e6bc17 (diff) | |
download | gnunet-f5a017ed63ee50feeefc6f0c2b28549aeca92ded.tar.gz gnunet-f5a017ed63ee50feeefc6f0c2b28549aeca92ded.zip |
-LRN: use FOPEN/CLOSE instead of fopen/close - #2051
Diffstat (limited to 'src')
-rw-r--r-- | src/dv/test_transport_api_dv.c | 4 | ||||
-rw-r--r-- | src/testing/test_testing_large_topology.c | 10 | ||||
-rw-r--r-- | src/testing/test_testing_topology.c | 8 | ||||
-rw-r--r-- | src/testing/test_testing_topology_blacklist.c | 12 | ||||
-rw-r--r-- | src/testing/testing_group.c | 8 | ||||
-rw-r--r-- | src/util/configuration.c | 4 | ||||
-rw-r--r-- | src/util/os_installation.c | 6 | ||||
-rw-r--r-- | src/util/service.c | 2 | ||||
-rw-r--r-- | src/util/test_crypto_hash.c | 4 |
9 files changed, 29 insertions, 29 deletions
diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index 435bb2a60..386ea5f29 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c | |||
@@ -274,8 +274,8 @@ finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
274 | #endif | 274 | #endif |
275 | if (dotOutFile != NULL) | 275 | if (dotOutFile != NULL) |
276 | { | 276 | { |
277 | fclose (dotOutFile); | ||
278 | FPRINTF (dotOutFile, "%s", "}"); | 277 | FPRINTF (dotOutFile, "%s", "}"); |
278 | FCLOSE (dotOutFile); | ||
279 | } | 279 | } |
280 | 280 | ||
281 | ok = 0; | 281 | ok = 0; |
@@ -383,7 +383,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
383 | if (dotOutFile != NULL) | 383 | if (dotOutFile != NULL) |
384 | { | 384 | { |
385 | FPRINTF (dotOutFile, "%s", "}"); | 385 | FPRINTF (dotOutFile, "%s", "}"); |
386 | fclose (dotOutFile); | 386 | FCLOSE (dotOutFile); |
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
diff --git a/src/testing/test_testing_large_topology.c b/src/testing/test_testing_large_topology.c index 2bca7b3b9..605761105 100644 --- a/src/testing/test_testing_large_topology.c +++ b/src/testing/test_testing_large_topology.c | |||
@@ -246,7 +246,7 @@ finish_testing () | |||
246 | if (dotOutFile != NULL) | 246 | if (dotOutFile != NULL) |
247 | { | 247 | { |
248 | FPRINTF (dotOutFile, "%s", "}"); | 248 | FPRINTF (dotOutFile, "%s", "}"); |
249 | fclose (dotOutFile); | 249 | FCLOSE (dotOutFile); |
250 | } | 250 | } |
251 | 251 | ||
252 | ok = 0; | 252 | ok = 0; |
@@ -303,7 +303,7 @@ topology_cb (void *cls, const struct GNUNET_PeerIdentity *first, | |||
303 | if (outfile != NULL) | 303 | if (outfile != NULL) |
304 | { | 304 | { |
305 | FPRINTF (outfile, "%s", "}\n"); | 305 | FPRINTF (outfile, "%s", "}\n"); |
306 | fclose (outfile); | 306 | FCLOSE (outfile); |
307 | GNUNET_SCHEDULER_add_now (&finish_testing, NULL); | 307 | GNUNET_SCHEDULER_add_now (&finish_testing, NULL); |
308 | } | 308 | } |
309 | } | 309 | } |
@@ -358,7 +358,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
358 | #endif | 358 | #endif |
359 | GNUNET_SCHEDULER_cancel (die_task); | 359 | GNUNET_SCHEDULER_cancel (die_task); |
360 | GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology"); | 360 | GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology"); |
361 | dotOutFileFinished = fopen (dotOutFileNameFinished, "w"); | 361 | dotOutFileFinished = FOPEN (dotOutFileNameFinished, "w"); |
362 | GNUNET_free (dotOutFileNameFinished); | 362 | GNUNET_free (dotOutFileNameFinished); |
363 | if (dotOutFileFinished != NULL) | 363 | if (dotOutFileFinished != NULL) |
364 | { | 364 | { |
@@ -425,7 +425,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
425 | if (dotOutFile != NULL) | 425 | if (dotOutFile != NULL) |
426 | { | 426 | { |
427 | FPRINTF (dotOutFile, "%s", "}"); | 427 | FPRINTF (dotOutFile, "%s", "}"); |
428 | fclose (dotOutFile); | 428 | FCLOSE (dotOutFile); |
429 | } | 429 | } |
430 | } | 430 | } |
431 | 431 | ||
@@ -949,7 +949,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
949 | 949 | ||
950 | ok = 1; | 950 | ok = 1; |
951 | 951 | ||
952 | dotOutFile = fopen (dotOutFileName, "w"); | 952 | dotOutFile = FOPEN (dotOutFileName, "w"); |
953 | if (dotOutFile != NULL) | 953 | if (dotOutFile != NULL) |
954 | { | 954 | { |
955 | FPRINTF (dotOutFile, "%s", "strict graph G {\n"); | 955 | FPRINTF (dotOutFile, "%s", "strict graph G {\n"); |
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index 17f3be89a..7404aa73e 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c | |||
@@ -339,7 +339,7 @@ topology_cb (void *cls, const struct GNUNET_PeerIdentity *first, | |||
339 | if (outfile != NULL) | 339 | if (outfile != NULL) |
340 | { | 340 | { |
341 | FPRINTF (outfile, "%s", "}\n"); | 341 | FPRINTF (outfile, "%s", "}\n"); |
342 | fclose (outfile); | 342 | FCLOSE (outfile); |
343 | #if DO_STATS | 343 | #if DO_STATS |
344 | GNUNET_TESTING_get_statistics (pg, &stats_finished, &stats_print, NULL); | 344 | GNUNET_TESTING_get_statistics (pg, &stats_finished, &stats_print, NULL); |
345 | #endif | 345 | #endif |
@@ -398,7 +398,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
398 | #endif | 398 | #endif |
399 | GNUNET_SCHEDULER_cancel (die_task); | 399 | GNUNET_SCHEDULER_cancel (die_task); |
400 | GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology"); | 400 | GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology"); |
401 | dotOutFileFinished = fopen (dotOutFileNameFinished, "w"); | 401 | dotOutFileFinished = FOPEN (dotOutFileNameFinished, "w"); |
402 | GNUNET_free (dotOutFileNameFinished); | 402 | GNUNET_free (dotOutFileNameFinished); |
403 | if (dotOutFileFinished != NULL) | 403 | if (dotOutFileFinished != NULL) |
404 | { | 404 | { |
@@ -465,7 +465,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
465 | if (dotOutFile != NULL) | 465 | if (dotOutFile != NULL) |
466 | { | 466 | { |
467 | FPRINTF (dotOutFile, "%s", "}"); | 467 | FPRINTF (dotOutFile, "%s", "}"); |
468 | fclose (dotOutFile); | 468 | FCLOSE (dotOutFile); |
469 | } | 469 | } |
470 | } | 470 | } |
471 | 471 | ||
@@ -1006,7 +1006,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1006 | 1006 | ||
1007 | ok = 1; | 1007 | ok = 1; |
1008 | 1008 | ||
1009 | dotOutFile = fopen (dotOutFileName, "w"); | 1009 | dotOutFile = FOPEN (dotOutFileName, "w"); |
1010 | if (dotOutFile != NULL) | 1010 | if (dotOutFile != NULL) |
1011 | { | 1011 | { |
1012 | FPRINTF (dotOutFile, "%s", "strict graph G {\n"); | 1012 | FPRINTF (dotOutFile, "%s", "strict graph G {\n"); |
diff --git a/src/testing/test_testing_topology_blacklist.c b/src/testing/test_testing_topology_blacklist.c index 9ff1fcbaa..d207ac2fc 100644 --- a/src/testing/test_testing_topology_blacklist.c +++ b/src/testing/test_testing_topology_blacklist.c | |||
@@ -143,7 +143,7 @@ finish_testing () | |||
143 | if (dotOutFile != NULL) | 143 | if (dotOutFile != NULL) |
144 | { | 144 | { |
145 | FPRINTF (dotOutFile, "%s", "}"); | 145 | FPRINTF (dotOutFile, "%s", "}"); |
146 | fclose (dotOutFile); | 146 | FCLOSE (dotOutFile); |
147 | } | 147 | } |
148 | 148 | ||
149 | ok = 0; | 149 | ok = 0; |
@@ -168,7 +168,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
168 | if (dotOutFile != NULL) | 168 | if (dotOutFile != NULL) |
169 | { | 169 | { |
170 | FPRINTF (dotOutFile, "%s", "}"); | 170 | FPRINTF (dotOutFile, "%s", "}"); |
171 | fclose (dotOutFile); | 171 | FCLOSE (dotOutFile); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
@@ -396,7 +396,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
396 | 396 | ||
397 | ok = 1; | 397 | ok = 1; |
398 | 398 | ||
399 | dotOutFile = fopen (dotOutFileName, "w"); | 399 | dotOutFile = FOPEN (dotOutFileName, "w"); |
400 | if (dotOutFile != NULL) | 400 | if (dotOutFile != NULL) |
401 | { | 401 | { |
402 | FPRINTF (dotOutFile, "%s", "strict graph G {\n"); | 402 | FPRINTF (dotOutFile, "%s", "strict graph G {\n"); |
@@ -414,7 +414,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
414 | ok = 404; | 414 | ok = 404; |
415 | if (dotOutFile != NULL) | 415 | if (dotOutFile != NULL) |
416 | { | 416 | { |
417 | fclose (dotOutFile); | 417 | FCLOSE (dotOutFile); |
418 | } | 418 | } |
419 | return; | 419 | return; |
420 | } | 420 | } |
@@ -453,7 +453,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
453 | ok = 707; | 453 | ok = 707; |
454 | if (dotOutFile != NULL) | 454 | if (dotOutFile != NULL) |
455 | { | 455 | { |
456 | fclose (dotOutFile); | 456 | FCLOSE (dotOutFile); |
457 | } | 457 | } |
458 | return; | 458 | return; |
459 | } | 459 | } |
@@ -470,7 +470,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
470 | ok = 808; | 470 | ok = 808; |
471 | if (dotOutFile != NULL) | 471 | if (dotOutFile != NULL) |
472 | { | 472 | { |
473 | fclose (dotOutFile); | 473 | FCLOSE (dotOutFile); |
474 | } | 474 | } |
475 | return; | 475 | return; |
476 | } | 476 | } |
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 4f67179c1..32adf465e 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -2891,7 +2891,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg) | |||
2891 | { | 2891 | { |
2892 | mytemp = GNUNET_DISK_mktemp ("friends"); | 2892 | mytemp = GNUNET_DISK_mktemp ("friends"); |
2893 | GNUNET_assert (mytemp != NULL); | 2893 | GNUNET_assert (mytemp != NULL); |
2894 | temp_friend_handle = fopen (mytemp, "wt"); | 2894 | temp_friend_handle = FOPEN (mytemp, "wt"); |
2895 | GNUNET_assert (temp_friend_handle != NULL); | 2895 | GNUNET_assert (temp_friend_handle != NULL); |
2896 | #if OLD | 2896 | #if OLD |
2897 | conn_iter = pg->peers[pg_iter].allowed_peers_head; | 2897 | conn_iter = pg->peers[pg_iter].allowed_peers_head; |
@@ -2907,7 +2907,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg) | |||
2907 | &friend_file_iterator, | 2907 | &friend_file_iterator, |
2908 | temp_friend_handle); | 2908 | temp_friend_handle); |
2909 | #endif | 2909 | #endif |
2910 | fclose (temp_friend_handle); | 2910 | FCLOSE (temp_friend_handle); |
2911 | 2911 | ||
2912 | if (GNUNET_OK != | 2912 | if (GNUNET_OK != |
2913 | GNUNET_CONFIGURATION_get_value_string (pg->peers[pg_iter].daemon->cfg, | 2913 | GNUNET_CONFIGURATION_get_value_string (pg->peers[pg_iter].daemon->cfg, |
@@ -3064,7 +3064,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, | |||
3064 | { | 3064 | { |
3065 | mytemp = GNUNET_DISK_mktemp ("blacklist"); | 3065 | mytemp = GNUNET_DISK_mktemp ("blacklist"); |
3066 | GNUNET_assert (mytemp != NULL); | 3066 | GNUNET_assert (mytemp != NULL); |
3067 | temp_file_handle = fopen (mytemp, "wt"); | 3067 | temp_file_handle = FOPEN (mytemp, "wt"); |
3068 | GNUNET_assert (temp_file_handle != NULL); | 3068 | GNUNET_assert (temp_file_handle != NULL); |
3069 | temp_transports = GNUNET_strdup (transports); | 3069 | temp_transports = GNUNET_strdup (transports); |
3070 | #if !OLD | 3070 | #if !OLD |
@@ -3106,7 +3106,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, | |||
3106 | } | 3106 | } |
3107 | 3107 | ||
3108 | GNUNET_free (temp_transports); | 3108 | GNUNET_free (temp_transports); |
3109 | fclose (temp_file_handle); | 3109 | FCLOSE (temp_file_handle); |
3110 | 3110 | ||
3111 | if (GNUNET_OK != | 3111 | if (GNUNET_OK != |
3112 | GNUNET_CONFIGURATION_get_value_string (pg->peers[pg_iter].daemon->cfg, | 3112 | GNUNET_CONFIGURATION_get_value_string (pg->peers[pg_iter].daemon->cfg, |
diff --git a/src/util/configuration.c b/src/util/configuration.c index eb86d0496..50f32e286 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -248,7 +248,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
248 | break; | 248 | break; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | GNUNET_assert (0 == fclose (fp)); | 251 | GNUNET_assert (0 == FCLOSE (fp)); |
252 | /* restore dirty flag - anything we set in the meantime | 252 | /* restore dirty flag - anything we set in the meantime |
253 | * came from disk */ | 253 | * came from disk */ |
254 | cfg->dirty = dirty; | 254 | cfg->dirty = dirty; |
@@ -348,7 +348,7 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
348 | } | 348 | } |
349 | if (error != 0) | 349 | if (error != 0) |
350 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", filename); | 350 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", filename); |
351 | GNUNET_assert (0 == fclose (fp)); | 351 | GNUNET_assert (0 == FCLOSE (fp)); |
352 | if (error != 0) | 352 | if (error != 0) |
353 | { | 353 | { |
354 | cfg->dirty = GNUNET_SYSERR; /* last write failed */ | 354 | cfg->dirty = GNUNET_SYSERR; /* last write failed */ |
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index c5cf1ccb3..6d25c5709 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -56,7 +56,7 @@ get_path_from_proc_maps () | |||
56 | char *lgu; | 56 | char *lgu; |
57 | 57 | ||
58 | GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/maps", getpid ()); | 58 | GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/maps", getpid ()); |
59 | f = fopen (fn, "r"); | 59 | f = FOPEN (fn, "r"); |
60 | if (f == NULL) | 60 | if (f == NULL) |
61 | return NULL; | 61 | return NULL; |
62 | while (NULL != fgets (line, sizeof (line), f)) | 62 | while (NULL != fgets (line, sizeof (line), f)) |
@@ -66,11 +66,11 @@ get_path_from_proc_maps () | |||
66 | (NULL != (lgu = strstr (dir, "libgnunetutil")))) | 66 | (NULL != (lgu = strstr (dir, "libgnunetutil")))) |
67 | { | 67 | { |
68 | lgu[0] = '\0'; | 68 | lgu[0] = '\0'; |
69 | fclose (f); | 69 | FCLOSE (f); |
70 | return GNUNET_strdup (dir); | 70 | return GNUNET_strdup (dir); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | fclose (f); | 73 | FCLOSE (f); |
74 | return NULL; | 74 | return NULL; |
75 | } | 75 | } |
76 | 76 | ||
diff --git a/src/util/service.c b/src/util/service.c index ebdf2c61a..8235830c9 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1351,7 +1351,7 @@ write_pid_file (struct GNUNET_SERVICE_Context *sctx, pid_t pid) | |||
1351 | } | 1351 | } |
1352 | if (0 > FPRINTF (pidfd, "%u", pid)) | 1352 | if (0 > FPRINTF (pidfd, "%u", pid)) |
1353 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", pif); | 1353 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", pif); |
1354 | GNUNET_break (0 == fclose (pidfd)); | 1354 | GNUNET_break (0 == FCLOSE (pidfd)); |
1355 | if ((user != NULL) && (0 < strlen (user))) | 1355 | if ((user != NULL) && (0 < strlen (user))) |
1356 | GNUNET_DISK_file_change_owner (pif, user); | 1356 | GNUNET_DISK_file_change_owner (pif, user); |
1357 | GNUNET_free_non_null (user); | 1357 | GNUNET_free_non_null (user); |
diff --git a/src/util/test_crypto_hash.c b/src/util/test_crypto_hash.c index b0fa4f332..bc0411482 100644 --- a/src/util/test_crypto_hash.c +++ b/src/util/test_crypto_hash.c | |||
@@ -137,9 +137,9 @@ testFileHash () | |||
137 | 137 | ||
138 | memset (block, 42, sizeof (block) / 2); | 138 | memset (block, 42, sizeof (block) / 2); |
139 | memset (&block[sizeof (block) / 2], 43, sizeof (block) / 2); | 139 | memset (&block[sizeof (block) / 2], 43, sizeof (block) / 2); |
140 | GNUNET_assert (NULL != (f = fopen (FILENAME, "w+"))); | 140 | GNUNET_assert (NULL != (f = FOPEN (FILENAME, "w+"))); |
141 | GNUNET_break (sizeof (block) == fwrite (block, 1, sizeof (block), f)); | 141 | GNUNET_break (sizeof (block) == fwrite (block, 1, sizeof (block), f)); |
142 | GNUNET_break (0 == fclose (f)); | 142 | GNUNET_break (0 == FCLOSE (f)); |
143 | ret = 1; | 143 | ret = 1; |
144 | GNUNET_SCHEDULER_run (&file_hasher, &ret); | 144 | GNUNET_SCHEDULER_run (&file_hasher, &ret); |
145 | GNUNET_break (0 == UNLINK (FILENAME)); | 145 | GNUNET_break (0 == UNLINK (FILENAME)); |