aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2011-12-30 22:43:52 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2011-12-30 22:43:52 +0000
commit3809a554279d1685b1c12163098355a3a55d664d (patch)
treeefb619e68756960821ff3ad667a1452db9add7f7
parent48d16551d055d3dab931c7a8b5b27930a681e88a (diff)
-LRN: use FOPEN/CLOSE instead of fopen/close - #2051
git-svn-id: https://gnunet.org/svn/gnunet@18856 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r--src/dv/test_transport_api_dv.c4
-rw-r--r--src/testing/test_testing_large_topology.c10
-rw-r--r--src/testing/test_testing_topology.c8
-rw-r--r--src/testing/test_testing_topology_blacklist.c12
-rw-r--r--src/testing/testing_group.c8
-rw-r--r--src/util/configuration.c4
-rw-r--r--src/util/os_installation.c6
-rw-r--r--src/util/service.c2
-rw-r--r--src/util/test_crypto_hash.c4
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 435bb2a608..386ea5f29c 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)
#endif
if (dotOutFile != NULL)
{
- fclose (dotOutFile);
FPRINTF (dotOutFile, "%s", "}");
+ FCLOSE (dotOutFile);
}
ok = 0;
@@ -383,7 +383,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (dotOutFile != NULL)
{
FPRINTF (dotOutFile, "%s", "}");
- fclose (dotOutFile);
+ FCLOSE (dotOutFile);
}
}
diff --git a/src/testing/test_testing_large_topology.c b/src/testing/test_testing_large_topology.c
index 2bca7b3b95..605761105b 100644
--- a/src/testing/test_testing_large_topology.c
+++ b/src/testing/test_testing_large_topology.c
@@ -246,7 +246,7 @@ finish_testing ()
if (dotOutFile != NULL)
{
FPRINTF (dotOutFile, "%s", "}");
- fclose (dotOutFile);
+ FCLOSE (dotOutFile);
}
ok = 0;
@@ -303,7 +303,7 @@ topology_cb (void *cls, const struct GNUNET_PeerIdentity *first,
if (outfile != NULL)
{
FPRINTF (outfile, "%s", "}\n");
- fclose (outfile);
+ FCLOSE (outfile);
GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
}
}
@@ -358,7 +358,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
#endif
GNUNET_SCHEDULER_cancel (die_task);
GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology");
- dotOutFileFinished = fopen (dotOutFileNameFinished, "w");
+ dotOutFileFinished = FOPEN (dotOutFileNameFinished, "w");
GNUNET_free (dotOutFileNameFinished);
if (dotOutFileFinished != NULL)
{
@@ -425,7 +425,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (dotOutFile != NULL)
{
FPRINTF (dotOutFile, "%s", "}");
- fclose (dotOutFile);
+ FCLOSE (dotOutFile);
}
}
@@ -949,7 +949,7 @@ run (void *cls, char *const *args, const char *cfgfile,
ok = 1;
- dotOutFile = fopen (dotOutFileName, "w");
+ dotOutFile = FOPEN (dotOutFileName, "w");
if (dotOutFile != NULL)
{
FPRINTF (dotOutFile, "%s", "strict graph G {\n");
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c
index 17f3be89a1..7404aa73e4 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,
if (outfile != NULL)
{
FPRINTF (outfile, "%s", "}\n");
- fclose (outfile);
+ FCLOSE (outfile);
#if DO_STATS
GNUNET_TESTING_get_statistics (pg, &stats_finished, &stats_print, NULL);
#endif
@@ -398,7 +398,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
#endif
GNUNET_SCHEDULER_cancel (die_task);
GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology");
- dotOutFileFinished = fopen (dotOutFileNameFinished, "w");
+ dotOutFileFinished = FOPEN (dotOutFileNameFinished, "w");
GNUNET_free (dotOutFileNameFinished);
if (dotOutFileFinished != NULL)
{
@@ -465,7 +465,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (dotOutFile != NULL)
{
FPRINTF (dotOutFile, "%s", "}");
- fclose (dotOutFile);
+ FCLOSE (dotOutFile);
}
}
@@ -1006,7 +1006,7 @@ run (void *cls, char *const *args, const char *cfgfile,
ok = 1;
- dotOutFile = fopen (dotOutFileName, "w");
+ dotOutFile = FOPEN (dotOutFileName, "w");
if (dotOutFile != NULL)
{
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 9ff1fcbaaa..d207ac2fcf 100644
--- a/src/testing/test_testing_topology_blacklist.c
+++ b/src/testing/test_testing_topology_blacklist.c
@@ -143,7 +143,7 @@ finish_testing ()
if (dotOutFile != NULL)
{
FPRINTF (dotOutFile, "%s", "}");
- fclose (dotOutFile);
+ FCLOSE (dotOutFile);
}
ok = 0;
@@ -168,7 +168,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (dotOutFile != NULL)
{
FPRINTF (dotOutFile, "%s", "}");
- fclose (dotOutFile);
+ FCLOSE (dotOutFile);
}
}
@@ -396,7 +396,7 @@ run (void *cls, char *const *args, const char *cfgfile,
ok = 1;
- dotOutFile = fopen (dotOutFileName, "w");
+ dotOutFile = FOPEN (dotOutFileName, "w");
if (dotOutFile != NULL)
{
FPRINTF (dotOutFile, "%s", "strict graph G {\n");
@@ -414,7 +414,7 @@ run (void *cls, char *const *args, const char *cfgfile,
ok = 404;
if (dotOutFile != NULL)
{
- fclose (dotOutFile);
+ FCLOSE (dotOutFile);
}
return;
}
@@ -453,7 +453,7 @@ run (void *cls, char *const *args, const char *cfgfile,
ok = 707;
if (dotOutFile != NULL)
{
- fclose (dotOutFile);
+ FCLOSE (dotOutFile);
}
return;
}
@@ -470,7 +470,7 @@ run (void *cls, char *const *args, const char *cfgfile,
ok = 808;
if (dotOutFile != NULL)
{
- fclose (dotOutFile);
+ FCLOSE (dotOutFile);
}
return;
}
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index 4f67179c1a..32adf465e0 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)
{
mytemp = GNUNET_DISK_mktemp ("friends");
GNUNET_assert (mytemp != NULL);
- temp_friend_handle = fopen (mytemp, "wt");
+ temp_friend_handle = FOPEN (mytemp, "wt");
GNUNET_assert (temp_friend_handle != NULL);
#if OLD
conn_iter = pg->peers[pg_iter].allowed_peers_head;
@@ -2907,7 +2907,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
&friend_file_iterator,
temp_friend_handle);
#endif
- fclose (temp_friend_handle);
+ FCLOSE (temp_friend_handle);
if (GNUNET_OK !=
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,
{
mytemp = GNUNET_DISK_mktemp ("blacklist");
GNUNET_assert (mytemp != NULL);
- temp_file_handle = fopen (mytemp, "wt");
+ temp_file_handle = FOPEN (mytemp, "wt");
GNUNET_assert (temp_file_handle != NULL);
temp_transports = GNUNET_strdup (transports);
#if !OLD
@@ -3106,7 +3106,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg,
}
GNUNET_free (temp_transports);
- fclose (temp_file_handle);
+ FCLOSE (temp_file_handle);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (pg->peers[pg_iter].daemon->cfg,
diff --git a/src/util/configuration.c b/src/util/configuration.c
index eb86d0496d..50f32e2864 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -248,7 +248,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
break;
}
}
- GNUNET_assert (0 == fclose (fp));
+ GNUNET_assert (0 == FCLOSE (fp));
/* restore dirty flag - anything we set in the meantime
* came from disk */
cfg->dirty = dirty;
@@ -348,7 +348,7 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
}
if (error != 0)
LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", filename);
- GNUNET_assert (0 == fclose (fp));
+ GNUNET_assert (0 == FCLOSE (fp));
if (error != 0)
{
cfg->dirty = GNUNET_SYSERR; /* last write failed */
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index c5cf1ccb36..6d25c57096 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -56,7 +56,7 @@ get_path_from_proc_maps ()
char *lgu;
GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/maps", getpid ());
- f = fopen (fn, "r");
+ f = FOPEN (fn, "r");
if (f == NULL)
return NULL;
while (NULL != fgets (line, sizeof (line), f))
@@ -66,11 +66,11 @@ get_path_from_proc_maps ()
(NULL != (lgu = strstr (dir, "libgnunetutil"))))
{
lgu[0] = '\0';
- fclose (f);
+ FCLOSE (f);
return GNUNET_strdup (dir);
}
}
- fclose (f);
+ FCLOSE (f);
return NULL;
}
diff --git a/src/util/service.c b/src/util/service.c
index ebdf2c61a9..8235830c99 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)
}
if (0 > FPRINTF (pidfd, "%u", pid))
LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", pif);
- GNUNET_break (0 == fclose (pidfd));
+ GNUNET_break (0 == FCLOSE (pidfd));
if ((user != NULL) && (0 < strlen (user)))
GNUNET_DISK_file_change_owner (pif, user);
GNUNET_free_non_null (user);
diff --git a/src/util/test_crypto_hash.c b/src/util/test_crypto_hash.c
index b0fa4f3325..bc0411482d 100644
--- a/src/util/test_crypto_hash.c
+++ b/src/util/test_crypto_hash.c
@@ -137,9 +137,9 @@ testFileHash ()
memset (block, 42, sizeof (block) / 2);
memset (&block[sizeof (block) / 2], 43, sizeof (block) / 2);
- GNUNET_assert (NULL != (f = fopen (FILENAME, "w+")));
+ GNUNET_assert (NULL != (f = FOPEN (FILENAME, "w+")));
GNUNET_break (sizeof (block) == fwrite (block, 1, sizeof (block), f));
- GNUNET_break (0 == fclose (f));
+ GNUNET_break (0 == FCLOSE (f));
ret = 1;
GNUNET_SCHEDULER_run (&file_hasher, &ret);
GNUNET_break (0 == UNLINK (FILENAME));