execve returns a value on error and this catches it
authorMarkus Brökers <mbroeker@largo.homelinux.org>
Tue, 17 Aug 2010 18:57:57 +0200
changeset 139 cb1d3f4cf18e
parent 138 dff18d1ac2af
child 140 05d42a3737a4
execve returns a value on error and this catches it
fork.c
mem2swap.c
--- a/fork.c
+++ b/fork.c
@@ -18,7 +18,8 @@
     switch (pid) {
     case 0:
         printf ("Starting new Process\n");
-        return execve (cmd, argv, argp);
+        execve (cmd, argv, argp);
+        exit (EXIT_FAILURE);
     case -1:
         perror ("FORK");
         return errno;
--- a/mem2swap.c
+++ b/mem2swap.c
@@ -78,6 +78,7 @@
     switch (pid) {
     case 0:
         execve (CMD_FREE, args, NULL);
+        exit (EXIT_FAILURE);
     case -1:
         perror ("Fork Error");
         return EXIT_FAILURE;