afsdir);
return GNUNET_SYSERR;
}
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_size (afsdir,
- &size,
- GNUNET_YES,
- GNUNET_YES))
+ if (GNUNET_SYSERR ==
+ GNUNET_DISK_file_size (afsdir,
+ &size,
+ GNUNET_YES,
+ GNUNET_YES))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Unable to get filesize: %s.\n"),
return GNUNET_SYSERR;
}
- buffer = GNUNET_malloc (size);
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_read (fh,
- buffer,
- size))
+ buffer = GNUNET_malloc (size) + 1;
+ if (GNUNET_SYSERR ==
+ GNUNET_DISK_file_read (fh,
+ buffer,
+ size))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Unable to read file: %s.\n"),
afsdir);
return GNUNET_SYSERR;
}
-
GNUNET_DISK_file_close (fh);
- if (0 < size) {
+
+ if (0 < size)
+ {
line = strtok (buffer, "\n");
while (line != NULL) {
zone_private_key = strtok (line, ",");
return GNUNET_YES;
}
+
/**
* Shutdown database connection and associate data
* structures.