Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F139374708
D26168.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D26168.diff
View Options
Index: head/sbin/ggate/ggated/ggated.c
===================================================================
--- head/sbin/ggate/ggated/ggated.c
+++ head/sbin/ggate/ggated/ggated.c
@@ -349,6 +349,16 @@
flags = O_WRONLY;
else
flags = O_RDWR;
+ if (conn->c_diskfd != -1) {
+ if (strcmp(conn->c_path, ex->e_path) != 0) {
+ g_gate_log(LOG_ERR, "old %s and new %s: "
+ "Path mismatch during handshakes.",
+ conn->c_path, ex->e_path);
+ return (EPERM);
+ }
+ return (0);
+ }
+
conn->c_diskfd = open(ex->e_path, flags);
if (conn->c_diskfd == -1) {
error = errno;
@@ -455,7 +465,7 @@
conn->c_token = cinit->gc_token;
ip = htonl(((struct sockaddr_in *)(void *)s)->sin_addr.s_addr);
conn->c_srcip = ip;
- conn->c_sendfd = conn->c_recvfd = -1;
+ conn->c_diskfd = conn->c_sendfd = conn->c_recvfd = -1;
if ((cinit->gc_flags & GGATE_FLAG_SEND) != 0)
conn->c_sendfd = sfd;
else
@@ -510,6 +520,8 @@
LIST_REMOVE(conn, c_next);
g_gate_log(LOG_DEBUG, "Connection removed [%s %s].",
ip2str(conn->c_srcip), conn->c_path);
+ if (conn->c_diskfd != -1)
+ close(conn->c_diskfd);
if (conn->c_sendfd != -1)
close(conn->c_sendfd);
if (conn->c_recvfd != -1)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 12, 10:15 AM (8 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26893993
Default Alt Text
D26168.diff (1 KB)
Attached To
Mode
D26168: Bug 132845: ggated: Fix double file open and file descriptor leak.
Attached
Detach File
Event Timeline
Log In to Comment