#include "gnunet_util_lib.h"
#include "disk.h"
-#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
-#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
-#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall)
+#define LOG(kind,...) GNUNET_log_from (kind, "util-network", __VA_ARGS__)
+#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-network", syscall, filename)
+#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-network", syscall)
#define DEBUG_NETWORK GNUNET_EXTRA_LOGGING
/* set permissions of newly created non-abstract UNIX domain socket to
"user-only"; applications can choose to relax this later */
mode_t old_mask = 0; /* assigned to make compiler happy */
- const struct sockaddr_un *un;
+ const struct sockaddr_un *un = (const struct sockaddr_un *) address;
int not_abstract = 0;
if ((AF_UNIX == address->sa_family)
- && (NULL != (un = (const struct sockaddr_un *) address)->sun_path)
&& ('\0' != un->sun_path[0]) ) /* Not an abstract socket */
not_abstract = 1;
if (not_abstract)
ret = close (desc->fd);
#endif
#ifndef WINDOWS
- const struct sockaddr_un *un;
+ const struct sockaddr_un *un = (const struct sockaddr_un *) desc->addr;
/* Cleanup the UNIX domain socket and its parent directories in case of non
abstract sockets */
if ( (AF_UNIX == desc->af) &&
(NULL != desc->addr) &&
- (NULL != (un = (const struct sockaddr_un *) desc->addr)->sun_path) &&
('\0' != un->sun_path[0]) )
{
char *dirname = GNUNET_strndup (un->sun_path,
* How much data is available to be read on this descriptor?
*
* @param desc socket
- * @returns #GNUNET_NO if no data is available, or on error!
+ * @returns #GNUNET_SYSERR if no data is available, or on error!
*/
ssize_t
GNUNET_NETWORK_socket_recvfrom_amount (const struct GNUNET_NETWORK_Handle *desc)
error = ioctl (desc->fd,
FIONREAD,
&pending);
- if (error == 0)
+ if (0 == error)
return (ssize_t) pending;
- return GNUNET_NO;
+ return GNUNET_SYSERR;
#else
u_long pending;
&pending);
if (error != SOCKET_ERROR)
return (ssize_t) pending;
- return GNUNET_NO;
+ return GNUNET_SYSERR;
#endif
}