* Set SHELL to /bin/sh in the environmant of shutdown.
* Retry to write out shutdown messages if interrupted.
This commit is contained in:
parent
2c2d31cb4c
commit
009d7247e4
@ -9,6 +9,8 @@
|
|||||||
to flush data and send them the ATA standby command. This should
|
to flush data and send them the ATA standby command. This should
|
||||||
avoid data loss on USB sticks and other removable block devices.
|
avoid data loss on USB sticks and other removable block devices.
|
||||||
* Flush block devices on halt/reboot if not done by the kernel.
|
* Flush block devices on halt/reboot if not done by the kernel.
|
||||||
|
* Set SHELL to /bin/sh in the environmant of shutdown.
|
||||||
|
* Retry to write out shutdown messages if interrupted.
|
||||||
|
|
||||||
sysvinit (2.88dsf) UNRELEASED; urgency=low
|
sysvinit (2.88dsf) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ char *clean_env[] = {
|
|||||||
"HOME=/",
|
"HOME=/",
|
||||||
"PATH=/bin:/usr/bin:/sbin:/usr/sbin",
|
"PATH=/bin:/usr/bin:/sbin:/usr/sbin",
|
||||||
"TERM=dumb",
|
"TERM=dumb",
|
||||||
|
"SHELL=/bin/sh",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -166,22 +167,34 @@ int init_setenv(char *name, char *value)
|
|||||||
sa.sa_handler = alrm_handler;
|
sa.sa_handler = alrm_handler;
|
||||||
sigaction(SIGALRM, &sa, NULL);
|
sigaction(SIGALRM, &sa, NULL);
|
||||||
got_alrm = 0;
|
got_alrm = 0;
|
||||||
alarm(3);
|
alarm(3);
|
||||||
if ((fd = open(INIT_FIFO, O_WRONLY)) >= 0 &&
|
if ((fd = open(INIT_FIFO, O_WRONLY)) >= 0) { &&
|
||||||
write(fd, &request, sizeof(request)) == sizeof(request)) {
|
ssize_t p = 0;
|
||||||
close(fd);
|
size_t s = sizeof(request);
|
||||||
alarm(0);
|
void *ptr = &request;
|
||||||
return 0;
|
while (s > 0) {
|
||||||
}
|
p = write(fd, ptr, s);
|
||||||
|
if (p < 0) {
|
||||||
|
if (errno == EINTR || errno == EAGAIN)
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ptr += p;
|
||||||
|
s -= p;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
alarm(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, "shutdown: ");
|
fprintf(stderr, "shutdown: ");
|
||||||
if (got_alrm) {
|
if (got_alrm) {
|
||||||
fprintf(stderr, "timeout opening/writing control channel %s\n",
|
fprintf(stderr, "timeout opening/writing control channel %s\n",
|
||||||
INIT_FIFO);
|
INIT_FIFO);
|
||||||
} else {
|
} else {
|
||||||
perror(INIT_FIFO);
|
perror(INIT_FIFO);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user