projects
/
swifty.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
09cb77a
)
raw: Add internal socket management support to sw_socket.
author
Razvan Deaconescu
<razvan.deaconescu@cs.pub.ro>
Sat, 21 May 2011 08:54:14 +0000
(11:54 +0300)
committer
Razvan Deaconescu
<razvan.deaconescu@cs.pub.ro>
Sat, 21 May 2011 08:54:14 +0000
(11:54 +0300)
src/raw/swift_raw.c
patch
|
blob
|
history
diff --git
a/src/raw/swift_raw.c
b/src/raw/swift_raw.c
index
441181a
..
4ed5ba7
100644
(file)
--- a/
src/raw/swift_raw.c
+++ b/
src/raw/swift_raw.c
@@
-19,6
+19,7
@@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <unistd.h>
#include "swift_types.h"
#include "swift_raw.h"
@@
-117,10
+118,22
@@
static struct sock_list *list_unlink_socket(int s)
int sw_socket (int __domain, int __type, int __protocol)
{
int s;
+ struct sock_list *list;
s = socket(__domain, SOCK_RAW, IPPROTO_SWIFT);
+ if (s < 0)
+ goto sock_err;
+
+ list = list_add_socket(s);
+ if (list == NULL)
+ goto list_add_err;
return s;
+
+list_add_err:
+ close(s);
+sock_err:
+ return -1;
}
/*