if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename))
return NULL;
- while (GNUNET_YES == GNUNET_DISK_file_test (filename))
+ while (GNUNET_YES != GNUNET_DISK_file_test (filename))
{
- fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_FAILIFEXISTS);
+ fd = GNUNET_DISK_file_open (filename,
+ GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_FAILIFEXISTS,
+ GNUNET_DISK_PERM_USER_READ| GNUNET_DISK_PERM_USER_WRITE | GNUNET_DISK_PERM_GROUP_READ);
if (NULL == fd)
{
if (errno == EEXIST)
GNUNET_assert (ntohs (enc->len) == GNUNET_DISK_file_write (fd, enc, ntohs (enc->len)));
GNUNET_free (enc);
-#ifndef MINGW
GNUNET_DISK_file_sync (fd);
if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, sizeof (struct RsaPrivateKeyBinaryEncoded)))
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"fcntl", filename);
-#endif
- GNUNET_assert (GNUNET_YES != GNUNET_DISK_file_close (fd));
+ GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Stored new private key in `%s'.\n"), filename);
return ret;
filename);
}
GNUNET_free (enc);
-#ifndef MINGW
if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, sizeof (struct RsaPrivateKeyBinaryEncoded)))
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename);
-#endif
- GNUNET_assert (0 == GNUNET_DISK_file_close (fd));
+ GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd));
return ret;
}
*
* @param hostkey private key to use for the signing
* @param purpose what to sign (size, purpose)
- * @param result where to write the signature
+ * @param sig where to write the signature
* @return GNUNET_SYSERR on error, GNUNET_OK on success
*/
int