From 99d39b121ed3504ecc4138efca9b41e38a921849 Mon Sep 17 00:00:00 2001 From: Thomas Backlund Date: Tue, 6 Dec 2011 18:51:00 +0000 Subject: 1.52: - fix build with gcc-4.6.2 * fixes for -Werror=unused-but-set-variable * minor whitespace cleanups --- mdk-stage1/init.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'mdk-stage1/init.c') diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c index 1d5841610..c4dacd944 100644 --- a/mdk-stage1/init.c +++ b/mdk-stage1/init.c @@ -116,20 +116,20 @@ void print_int_init(int fd, int i) char buf[10]; char * chptr = buf + 9; int j = 0; - + if (i < 0) { write(1, "-", 1); i = -1 * i; } - + while (i) { *chptr-- = '0' + (i % 10); j++; i = i / 10; } - + write(fd, chptr + 1, j); } @@ -176,7 +176,7 @@ void doklog() close(1); close(2); } - + out = open("/dev/tty4", O_WRONLY, 0); if (out < 0) print_warning("couldn't open tty for syslog -- still using /tmp/syslog\n"); @@ -218,7 +218,7 @@ void doklog() if (sock >= 0) FD_SET(sock, &readset); FD_SET(in, &readset); - + i = select(20, &readset, NULL, NULL, NULL); if (i <= 0) continue; @@ -305,10 +305,9 @@ void unmount_filesystems(void) struct filesystem fs[500]; int numfs = 0; int i, nb; - int disallow_eject = 0; printf("unmounting filesystems...\n"); - + fd = open("/proc/mounts", O_RDONLY, 0); if (fd < 1) { print_error("failed to open /proc/mounts"); @@ -335,8 +334,6 @@ void unmount_filesystems(void) *p++ = '\0'; while (*p != '\n') p++; p++; - if (!strcmp(fs[numfs].fs, "nfs")) - disallow_eject = 1; if (strcmp(fs[numfs].name, "/") && !strstr(fs[numfs].dev, "ram") && strcmp(fs[numfs].name, "/dev") @@ -360,14 +357,14 @@ void unmount_filesystems(void) } } } while (nb); - + for (i = nb = 0; i < numfs; i++) if (fs[i].mounted) { printf("\tumount failed: %s\n", fs[i].name); if (strcmp(fs[i].fs, "ext3") == 0) nb++; /* don't count not-ext3 umount failed */ } - + if (nb) { printf("failed to umount some filesystems\n"); select(0, NULL, NULL, NULL, NULL); @@ -422,7 +419,7 @@ int main(int argc, char **argv) if (mount("none", "/sys", "sysfs", 0, NULL)) fatal_error("Unable to mount sysfs filesystem"); } - + /* ignore Control-C and keyboard stop signals */ signal(SIGINT, SIG_IGN); @@ -432,13 +429,13 @@ int main(int argc, char **argv) fd = open("/dev/console", O_RDWR, 0); if (fd < 0) fatal_error("failed to open /dev/console"); - + dup2(fd, 0); dup2(fd, 1); dup2(fd, 2); close(fd); } - + /* I set me up as session leader (probably not necessary?) */ setsid(); @@ -458,7 +455,7 @@ int main(int argc, char **argv) /* Go into normal init mode - keep going, and then do a orderly shutdown when: - + 1) install exits 2) we receive a SIGHUP */ -- cgit v1.2.1