File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1854,19 +1854,32 @@ int main(int argc, char* argv[]) {
18541854 }
18551855
18561856 if (apprun_pid == 0 ) {
1857- /* Child process - exec AppRun */
1857+ /* Child process - close keepalive pipe before exec */
1858+ close (keepalive_pipe [0 ]);
1859+ close (keepalive_pipe [1 ]);
1860+
1861+ /* exec AppRun */
18581862 execv (filename , real_argv );
18591863 /* Error if we continue here */
18601864 perror ("execv error" );
18611865 exit (EXIT_EXECERROR );
18621866 } else {
18631867 /* Parent process - wait for AppRun to finish, then close pipe */
18641868 int status ;
1865- waitpid (apprun_pid , & status , 0 );
1869+ pid_t waited_pid = waitpid (apprun_pid , & status , 0 );
1870+ if (waited_pid == -1 ) {
1871+ perror ("waitpid error" );
1872+ close (keepalive_pipe [0 ]);
1873+ free (real_argv );
1874+ exit (EXIT_EXECERROR );
1875+ }
18661876
18671877 /* Close the keepalive pipe after AppRun exits to terminate FUSE daemon */
18681878 close (keepalive_pipe [0 ]);
18691879
1880+ /* Free allocated memory before exit */
1881+ free (real_argv );
1882+
18701883 /* Exit with the same status as AppRun */
18711884 if (WIFEXITED (status )) {
18721885 exit (WEXITSTATUS (status ));
You can’t perform that action at this time.
0 commit comments