Make shell example check for invalid join return,
because passing an invalid value to exec is allowed to kill the
process.
#include <debug.h>
typedef int pid_t;
#include <debug.h>
typedef int pid_t;
+#define PID_ERROR ((pid_t) -1)
void halt (void) NO_RETURN;
void exit (int status) NO_RETURN;
void halt (void) NO_RETURN;
void exit (int status) NO_RETURN;
/* Execute command. */
if (cp > command)
/* Execute command. */
if (cp > command)
+ {
+ pid_t pid = exec (command);
+ if (pid != PID_ERROR)
+ join (pid);
+ else
+ printf ("exec failed\n");
+ }