gnunet-service-rps_sampler.h gnunet-service-rps_sampler.c \
gnunet-service-rps_custommap.h gnunet-service-rps_custommap.c \
gnunet-service-rps_view.h gnunet-service-rps_view.c \
- rps-test_util.h rps-test_util.c \
gnunet-service-rps.c
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
return name_buf;
}
-
-
-char *
-create_file (const char *name)
-{
- int size;
- size_t name_buf_size;
- char *name_buf;
- char *prefix;
- char *file_name;
-
- prefix = "/tmp/rps/";
- name_buf_size = (strlen (prefix) + strlen (name) + 2) * sizeof (char);
- name_buf = GNUNET_malloc (name_buf_size);
-
- size = GNUNET_snprintf (name_buf, name_buf_size, "%s%s", prefix, name);
- if (0 > size)
- LOG (GNUNET_ERROR_TYPE_WARNING, "Failed to create name_buf\n");
-
- if (GNUNET_YES != GNUNET_DISK_directory_create (prefix))
- {
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Could not create directory %s.\n",
- prefix);
- }
-
- if (NULL == strstr (name, "sampler_el"))
- {/* only append random string to sampler */
- if (NULL == (file_name = GNUNET_DISK_mktemp (name_buf)))
- LOG (GNUNET_ERROR_TYPE_WARNING, "Could not create file\n");
-
- GNUNET_free (name_buf);
- return file_name;
- }
-
- return name_buf;
-}
-
#endif /* TO_FILE */
* @return #GNUNET_YES on success
* #GNUNET_SYSERR on failure
*/
-static int ensure_folder_exist (void)
+static int
+ensure_folder_exist (void)
{
- if (GNUNET_NO == GNUNET_DISK_directory_test ("/tmp/rps/", GNUNET_NO))
- {
- GNUNET_DISK_directory_create ("/tmp/rps");
- }
- if (GNUNET_YES != GNUNET_DISK_directory_test ("/tmp/rps/", GNUNET_NO))
+ if (GNUNET_OK !=
+ GNUNET_DISK_directory_create ("/tmp/rps"))
{
- LOG (GNUNET_ERROR_TYPE_ERROR, "Could not create directory `/tmp/rps'\n");
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "Could not create directory `/tmp/rps'\n");
return GNUNET_SYSERR;
}
return GNUNET_YES;
}
+
char *
store_prefix_file_name (const struct GNUNET_PeerIdentity *peer,
- const char *prefix)
+ const char *prefix)
{
int len_file_name;
int out_size;
struct GNUNET_CRYPTO_AuthKey
string_to_auth_key (const char *str);
-char *
-create_file (const char *name);
/**
* @brief Get file handle
* This function is used to facilitate writing important information to disk
*/
#ifdef TO_FILE
-#define to_file(file_name, ...) do { if (NULL == file_name) { GNUNET_break(0); return;} \
+#define to_file(file_name, ...) do { \
char tmp_buf[512] = "";\
int size;\
+ if (NULL == file_name) return; \
size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\
if (0 > size)\
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
* does not exist or stat'ed
*/
int
-GNUNET_DISK_directory_test (const char *fil, int is_readable)
+GNUNET_DISK_directory_test (const char *fil,
+ int is_readable)
{
struct stat filestat;
int ret;
}
if (!S_ISDIR (filestat.st_mode))
{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_INFO,
"A file already exits with the same name %s\n", fil);
return GNUNET_NO;
}
rdir = GNUNET_STRINGS_filename_expand (dir);
if (rdir == NULL)
+ {
+ GNUNET_break (0);
return GNUNET_SYSERR;
+ }
len = strlen (rdir);
#ifndef MINGW
ret = GNUNET_DISK_directory_test (rdir, GNUNET_NO);
if (GNUNET_NO == ret)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Creating directory `%s' failed",
+ rdir);
GNUNET_free (rdir);
return GNUNET_SYSERR;
}
ret = GNUNET_DISK_directory_test (rdir, GNUNET_NO);
if (GNUNET_NO == ret)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Creating directory `%s' failed",
+ rdir);
GNUNET_free (rdir);
return GNUNET_SYSERR;
}
{
const char *option = cls;
char *tmpname;
-
+
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (cfg,
"PATHS",