Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142328530
D26168.id76136.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
797 B
Referenced Files
None
Subscribers
None
D26168.id76136.diff
View Options
Index: sbin/ggate/ggated/ggated.c
===================================================================
--- sbin/ggate/ggated/ggated.c
+++ sbin/ggate/ggated/ggated.c
@@ -349,6 +349,9 @@
flags = O_WRONLY;
else
flags = O_RDWR;
+ if (conn->c_diskfd != -1)
+ return (0);
+
conn->c_diskfd = open(ex->e_path, flags);
if (conn->c_diskfd == -1) {
error = errno;
@@ -452,6 +455,7 @@
free(conn);
return (NULL);
}
+ conn->c_diskfd = -1;
conn->c_token = cinit->gc_token;
ip = htonl(((struct sockaddr_in *)(void *)s)->sin_addr.s_addr);
conn->c_srcip = ip;
@@ -532,8 +536,10 @@
int error, pid;
pid = fork();
- if (pid > 0)
+ if (pid > 0) {
+ close(conn->c_diskfd);
return;
+ }
else if (pid == -1) {
g_gate_log(LOG_ERR, "Cannot fork: %s.", strerror(errno));
return;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 3:36 PM (10 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27748593
Default Alt Text
D26168.id76136.diff (797 B)
Attached To
Mode
D26168: Bug 132845: ggated: Fix double file open and file descriptor leak.
Attached
Detach File
Event Timeline
Log In to Comment