X-Git-Url: https://git.jankratochvil.net/?p=gnokii.git;a=blobdiff_plain;f=gnokii%2Fgnokii.c;h=1cbe8fe70378e05a7aa14a1b77851eda7dc6169a;hp=fadf2b4913e5812259773aa2749e0a749e3641de;hb=8ec00ff9eb42ae2367cf9798f2bc66299a0d24ca;hpb=8f1eee8a4da6f78a0ee3bb4b8e735e367af42ac9 diff --git a/gnokii/gnokii.c b/gnokii/gnokii.c index fadf2b4..1cbe8fe 100644 --- a/gnokii/gnokii.c +++ b/gnokii/gnokii.c @@ -1282,7 +1282,7 @@ int main(int argc, char *argv[]) for(i = 2; i < argc; i++) nargv[i-2] = argv[i]; - nargv[argc] = NULL; /* required by gnokiid() for execv(3) */ + nargv[argc-2] = NULL; /* required by gnokiid() for execv(3) */ if(checkargs(c, gals, nargc)) { @@ -4119,6 +4119,14 @@ int monitormode(int argc, char *argv[]) #ifdef UCLINUX +#define NICE_LEVEL (-20) + +static void gnokiid_SIGCHLD(int signo) +{ + fprintf (stderr, _("Child process exited, aborting...\n")); + exit(2); +} + static int gnokiid(int argc, char *argv[]) { bool DebugMode; /* When true, run in debug mode */ @@ -4154,15 +4162,15 @@ static int gnokiid(int argc, char *argv[]) #ifdef DEBUG fprintf (stderr, _("Spawning gnokiid startup child process \"%s\"...\n"), *argv); #endif - /* default action for SIGCHLD is SIG_IGN, should be OK */ + signal(SIGCHLD,gnokiid_SIGCHLD); errno=0; switch (vfork()) { case -1: /* vfork() failure */ - fprintf (stderr, _("vfork() failed! (%m)\n")); + fprintf (stderr, _("vfork() failed! (%s)\n"),strerror(errno)); return -1; case 0: /* child */ execv(*argv,argv); - fprintf (stderr, _("Spawn of child process failed! (%m)\n")); + fprintf (stderr, _("Spawn of child process failed! (%s)\n"),strerror(errno)); _exit(9); break; default: /* parent */ @@ -4174,6 +4182,8 @@ static int gnokiid(int argc, char *argv[]) #ifdef DEBUG fprintf (stderr, _("Entering gnokiid virtual modem main loop...\n")); #endif + if (nice(NICE_LEVEL)) + fprintf (stderr, _("WARNING: nice level change failed (by %d)\n"),NICE_LEVEL); VM_ThreadLoop();