summaryrefslogtreecommitdiff
path: root/src/socket_udp.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
commit5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (patch)
tree684758441f5b431d0008253243034b6a4a29417c /src/socket_udp.c
parent249866e3d1e11dc72eaa1305f4bb479ded92ef38 (diff)
initial clang-format
Diffstat (limited to 'src/socket_udp.c')
-rw-r--r--src/socket_udp.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/socket_udp.c b/src/socket_udp.c
index 743cdf1..2ac6068 100644
--- a/src/socket_udp.c
+++ b/src/socket_udp.c
@@ -1,15 +1,17 @@
-#include <sys/types.h>
+#include <netinet/in.h>
#include <sys/param.h>
#include <sys/socket.h>
-#include <netinet/in.h>
+#include <sys/types.h>
+
#include <errno.h>
-#include "close.h" /* better use unistd.h ? */
+
+#include "close.h" /* better use unistd.h ? */
+#include "error.h"
#include "ndelay.h"
#include "socket_if.h"
-#include "error.h"
#ifndef EAFNOSUPPORT
-#define EAFNOSUPPORT EINVAL
+ #define EAFNOSUPPORT EINVAL
#endif
/**
@@ -23,35 +25,44 @@ int socket_udp6(void)
{
int s;
- s = socket(AF_INET6,SOCK_DGRAM,0);
+ s = socket(AF_INET6, SOCK_DGRAM, 0);
if (s != -1)
- if (ndelay_on(s) == -1) { close(s); return -1; }
+ if (ndelay_on(s) == -1) {
+ close(s);
+ return -1;
+ }
return s;
-}
+}
int socket_udp4(void)
{
int s;
- s = socket(AF_INET,SOCK_DGRAM,0);
+ s = socket(AF_INET, SOCK_DGRAM, 0);
if (s != -1)
- if (ndelay_on(s) == -1) { close(s); return -1; }
+ if (ndelay_on(s) == -1) {
+ close(s);
+ return -1;
+ }
return s;
-}
+}
int socket_udp(void)
{
int s;
- s = socket(AF_INET6,SOCK_DGRAM,0);
- if (s == -1)
+ s = socket(AF_INET6, SOCK_DGRAM, 0);
+ if (s == -1)
if (errno == EINVAL || errno == EAFNOSUPPORT || errno == EPROTO || errno == EPROTONOSUPPORT)
- s = socket(AF_INET,SOCK_DGRAM,0);
+ s = socket(AF_INET, SOCK_DGRAM, 0);
if (s != -1)
- if (ndelay_on(s) == -1) { close(s); return -1; }
+ if (ndelay_on(s) == -1) {
+ close(s);
+ return -1;
+ }
return s;
}