[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35004 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35004 - gnunet/src/util |
Date: |
Mon, 26 Jan 2015 00:14:45 +0100 |
Author: grothoff
Date: 2015-01-26 00:14:45 +0100 (Mon, 26 Jan 2015)
New Revision: 35004
Modified:
gnunet/src/util/configuration.c
gnunet/src/util/disk.c
gnunet/src/util/network.c
gnunet/src/util/service.c
Log:
-make sure we get the correct errno back after GNUNET_NETWORK_socket_create()
Modified: gnunet/src/util/configuration.c
===================================================================
--- gnunet/src/util/configuration.c 2015-01-25 22:59:22 UTC (rev 35003)
+++ gnunet/src/util/configuration.c 2015-01-25 23:14:45 UTC (rev 35004)
@@ -346,7 +346,8 @@
if (fs != GNUNET_DISK_fn_read (fn, mem, fs))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- "Error while reading file %s\n", fn);
+ "Error while reading file %s\n",
+ fn);
GNUNET_free (fn);
GNUNET_free (mem);
return GNUNET_SYSERR;
Modified: gnunet/src/util/disk.c
===================================================================
--- gnunet/src/util/disk.c 2015-01-25 22:59:22 UTC (rev 35003)
+++ gnunet/src/util/disk.c 2015-01-25 23:14:45 UTC (rev 35004)
@@ -939,7 +939,9 @@
return GNUNET_SYSERR;
}
}
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Read %u bytes\n", bytes_read);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Read %u bytes\n",
+ bytes_read);
}
else
{
@@ -982,8 +984,10 @@
struct GNUNET_DISK_FileHandle *fh;
ssize_t ret;
- fh = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_READ,
GNUNET_DISK_PERM_NONE);
- if (!fh)
+ fh = GNUNET_DISK_file_open (fn,
+ GNUNET_DISK_OPEN_READ,
+ GNUNET_DISK_PERM_NONE);
+ if (NULL == fh)
return GNUNET_SYSERR;
ret = GNUNET_DISK_file_read (fh, result, len);
GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
@@ -1196,7 +1200,7 @@
unsigned int name_len;
unsigned int n_size;
- GNUNET_assert (dir_name != NULL);
+ GNUNET_assert (NULL != dir_name);
dname = GNUNET_STRINGS_filename_expand (dir_name);
if (dname == NULL)
return GNUNET_SYSERR;
@@ -1208,7 +1212,7 @@
GNUNET_free (dname);
return GNUNET_SYSERR;
}
- if (!S_ISDIR (istat.st_mode))
+ if (! S_ISDIR (istat.st_mode))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
_("Expected `%s' to be a directory!\n"),
@@ -1218,7 +1222,7 @@
}
errno = 0;
dinfo = OPENDIR (dname);
- if ((errno == EACCES) || (dinfo == NULL))
+ if ((errno == EACCES) || (NULL == dinfo))
{
LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "opendir", dname);
if (dinfo != NULL)
@@ -1229,12 +1233,12 @@
name_len = 256;
n_size = strlen (dname) + name_len + 2;
name = GNUNET_malloc (n_size);
- while ((finfo = READDIR (dinfo)) != NULL)
+ while (NULL != (finfo = READDIR (dinfo)))
{
if ((0 == strcmp (finfo->d_name, ".")) ||
(0 == strcmp (finfo->d_name, "..")))
continue;
- if (callback != NULL)
+ if (NULL != callback)
{
if (name_len < strlen (finfo->d_name))
{
Modified: gnunet/src/util/network.c
===================================================================
--- gnunet/src/util/network.c 2015-01-25 22:59:22 UTC (rev 35003)
+++ gnunet/src/util/network.c 2015-01-25 23:14:45 UTC (rev 35004)
@@ -931,14 +931,13 @@
int protocol)
{
struct GNUNET_NETWORK_Handle *ret;
+ int fd;
+ fd = socket (domain, type, protocol);
+ if (-1 == fd)
+ return NULL;
ret = GNUNET_new (struct GNUNET_NETWORK_Handle);
- ret->fd = socket (domain, type, protocol);
- if (-1 == ret->fd)
- {
- GNUNET_free (ret);
- return NULL;
- }
+ ret->fd = fd;
if (GNUNET_OK !=
initialize_network_handle (ret,
domain,
Modified: gnunet/src/util/service.c
===================================================================
--- gnunet/src/util/service.c 2015-01-25 22:59:22 UTC (rev 35003)
+++ gnunet/src/util/service.c 2015-01-25 23:14:45 UTC (rev 35004)
@@ -549,7 +549,7 @@
else
disablev6 = GNUNET_NO;
- if (!disablev6)
+ if (! disablev6)
{
/* probe IPv6 support */
desc = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
@@ -562,8 +562,7 @@
return GNUNET_SYSERR;
}
LOG (GNUNET_ERROR_TYPE_INFO,
- _
- ("Disabling IPv6 support for service `%s', failed to create IPv6
socket: %s\n"),
+ _("Disabling IPv6 support for service `%s', failed to create IPv6
socket: %s\n"),
service_name, STRERROR (errno));
disablev6 = GNUNET_YES;
}
@@ -623,7 +622,8 @@
(unsigned long long) sizeof (s_un.sun_path));
unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath);
LOG (GNUNET_ERROR_TYPE_INFO,
- _("Using `%s' instead\n"), unixpath);
+ _("Using `%s' instead\n"),
+ unixpath);
}
#ifdef LINUX
abstract = GNUNET_CONFIGURATION_get_value_yesno (cfg,
@@ -654,7 +654,8 @@
}
LOG (GNUNET_ERROR_TYPE_INFO,
_("Disabling UNIX domain socket support for service `%s', failed to
create UNIX domain socket: %s\n"),
- service_name, STRERROR (errno));
+ service_name,
+ STRERROR (errno));
GNUNET_free (unixpath);
unixpath = NULL;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35004 - gnunet/src/util,
gnunet <=