Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147529030
D50537.1783678614.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1002 B
Referenced Files
None
Subscribers
None
D50537.1783678614.diff
View Options
diff --git a/libexec/flua/modules/lfbsd.c b/libexec/flua/modules/lfbsd.c
--- a/libexec/flua/modules/lfbsd.c
+++ b/libexec/flua/modules/lfbsd.c
@@ -88,13 +88,22 @@
argv = luaL_checkarraystrings(L, 1);
if (0 != (r = posix_spawnp(&pid, argv[0], &action, NULL,
(char*const*)argv, environ))) {
+ close(stdin_pipe[0]);
+ close(stdin_pipe[1]);
+ posix_spawn_file_actions_destroy(&action);
+
lua_pushnil(L);
lua_pushstring(L, strerror(r));
lua_pushinteger(L, r);
return (3);
}
+
+ close(stdin_pipe[0]);
+ posix_spawn_file_actions_destroy(&action);
+
while (waitpid(pid, &pstat, 0) == -1) {
if (errno != EINTR) {
+ close(stdin_pipe[1]);
lua_pushnil(L);
lua_pushstring(L, strerror(r));
lua_pushinteger(L, r);
@@ -109,12 +118,7 @@
return (3);
}
- posix_spawn_file_actions_destroy(&action);
-
- if (stdin_pipe[0] != -1)
- close(stdin_pipe[0]);
- if (stdin_pipe[1] != -1)
- close(stdin_pipe[1]);
+ close(stdin_pipe[1]);
lua_pushinteger(L, pid);
return 1;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jul 10, 10:16 AM (7 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29056334
Default Alt Text
D50537.1783678614.diff (1002 B)
Attached To
Mode
D50537: flua: fbsd: avoid leaking stdin pipes on error
Attached
Detach File
Event Timeline
Log In to Comment