File tree Expand file tree Collapse file tree 1 file changed +1
-41
lines changed Expand file tree Collapse file tree 1 file changed +1
-41
lines changed Original file line number Diff line number Diff line change @@ -20,34 +20,6 @@ using v8::String;
20
20
using v8::Value;
21
21
22
22
23
- #if !defined(SOCK_NONBLOCK)
24
- void SetNonBlock (int fd) {
25
- int flags;
26
- int r;
27
-
28
- flags = fcntl (fd, F_GETFL);
29
- assert (flags != -1 );
30
-
31
- r = fcntl (fd, F_SETFL, flags | O_NONBLOCK);
32
- assert (r != -1 );
33
- }
34
- #endif
35
-
36
-
37
- #if !defined(SOCK_CLOEXEC)
38
- void SetCloExec (int fd) {
39
- int flags;
40
- int r;
41
-
42
- flags = fcntl (fd, F_GETFD);
43
- assert (flags != -1 );
44
-
45
- r = fcntl (fd, F_SETFD, flags | FD_CLOEXEC);
46
- assert (r != -1 );
47
- }
48
- #endif
49
-
50
-
51
23
NAN_METHOD (Socket) {
52
24
Nan::HandleScope scope;
53
25
int fd;
@@ -56,26 +28,14 @@ NAN_METHOD(Socket) {
56
28
assert (info.Length () == 0 );
57
29
58
30
type = SOCK_STREAM;
59
- #if defined(SOCK_NONBLOCK)
60
- type |= SOCK_NONBLOCK;
61
- #endif
62
- #if defined(SOCK_CLOEXEC)
63
- type |= SOCK_CLOEXEC;
64
- #endif
31
+ type |= SOCK_NONBLOCK | SOCK_CLOEXEC;
65
32
66
33
fd = socket (AF_UNIX, type, 0 );
67
34
if (fd == -1 ) {
68
35
fd = -errno;
69
36
goto out;
70
37
}
71
38
72
- #if !defined(SOCK_NONBLOCK)
73
- SetNonBlock (fd);
74
- #endif
75
- #if !defined(SOCK_CLOEXEC)
76
- SetCloExec (fd);
77
- #endif
78
-
79
39
out:
80
40
info.GetReturnValue ().Set (fd);
81
41
}
You can’t perform that action at this time.
0 commit comments