mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-19 17:23:33 +01:00
wmaker: don't exit wmaker if app child process errored
This patch is fixing a possible memory corruption and abnormal exit of wmaker when a created child process errored. This had been kind of mentioned at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1040643 and I also experienced it with especially Steam. At first, I also thought it was a crash or a memory corruption, but gdb or valgrind are not reporting anything. In fact, Steam is not setting properly some hints and that is bringing some issues. More patches will be needed to support that app properly. For example, WM_COMMAND is not set properly and when you are trying to relaunch the app from the appIcon the child process is generating an error and the actual code is calling Exit(-1) which is entirely exiting wmaker, that's why from gdb you can see the message [Inferior 4 (process 567278) exited normally] and no crash.
This commit is contained in:
committed by
Carlos R. Mafra
parent
e45a3bc07d
commit
189679b49c
10
src/main.c
10
src/main.c
@@ -326,7 +326,8 @@ void ExecuteShellCommand(WScreen *scr, const char *command)
|
||||
#endif
|
||||
execl(shell, shell, "-c", command, NULL);
|
||||
werror("could not execute %s -c %s", shell, command);
|
||||
Exit(-1);
|
||||
/* exec failed in child -- exit immediately without running parent cleanup */
|
||||
_exit(127);
|
||||
} else if (pid < 0) {
|
||||
werror("cannot fork a new process");
|
||||
} else {
|
||||
@@ -377,10 +378,10 @@ Bool RelaunchWindow(WWindow *wwin)
|
||||
setsid();
|
||||
#endif
|
||||
/* argv is not null-terminated */
|
||||
char **a = (char **) malloc(argc + 1);
|
||||
char **a = malloc((argc + 1) * sizeof(char *));
|
||||
if (! a) {
|
||||
werror("out of memory trying to relaunch the application");
|
||||
Exit(-1);
|
||||
_exit(127);
|
||||
}
|
||||
|
||||
int i;
|
||||
@@ -389,7 +390,8 @@ Bool RelaunchWindow(WWindow *wwin)
|
||||
a[i] = NULL;
|
||||
|
||||
execvp(a[0], a);
|
||||
Exit(-1);
|
||||
/* exec failed in child -- exit immediately */
|
||||
_exit(127);
|
||||
} else if (pid < 0) {
|
||||
werror("cannot fork a new process");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user