commit 8c59487a9c1e1d264d78da4d841fada50b2a3ec7
parent e825daebf1ba85b18df827e7054ff3f4670b7ddd
Author: leitner <leitner>
Date: Tue, 20 May 2003 16:20:16 +0000
shutdown fixes (from Florian)
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/openreadclose.c b/openreadclose.c
@@ -1,6 +1,7 @@
#ifndef EMBEDDED
#include <unistd.h>
#include <fcntl.h>
+#include <stdlib.h>
#endif
int openreadclose(char *fn, char **buf, unsigned long *len) {
diff --git a/shutdown.c b/shutdown.c
@@ -63,7 +63,7 @@ int exec_cmd(char *cmd, ...) {
pid = fork();
if (pid < 0) return -1;
if (pid > 0) {
- while (wait(NULL) != pid);
+ wait(NULL);
} else {
execve(cmd, argv, environ);
//perror("execvp failed");
@@ -105,7 +105,7 @@ int minit_serviceDown(char *service) {
pid = atoi(buf);
}
- if (strcmp("reboot",service) && strcmp("halt",service) && pid != 1) {
+ if (strcmp("reboot",service) && strcmp("halt",service) && pid > 1) {
__write2("\t--> "); __write2(service);
buf[0]='r'; // we want to disable respawning first
strncpy(buf+1, service, 1400);