update_flash: fix 'reboot' option

While on busybox' init you can reboot the system sending a TERM signal
to pid '1' it seems that in sysvinit package this does not work, so
implement a proper reboot using the system call.

https://jira.digi.com/browse/DEL-212 #resolve

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2013-01-28 19:14:12 +01:00
parent 68c5a90ebf
commit 7fffaecfa2
1 changed files with 2 additions and 4 deletions

View File

@ -29,6 +29,7 @@
#include <stdlib.h> /* EXIT_SUCCESS */
#include <string.h> /* memset */
#include <unistd.h> /* close */
#include <sys/reboot.h> /* reboot */
#include <arpa/inet.h> /* ntohl */
#include <mntent.h> /* setmntent */
@ -383,10 +384,7 @@ int main(int argc, char *argv[])
if (cDoReboot) {
sync();
PRINTF("Rebooting System\n");
/* kills init */
kill(1, SIGTERM);
reboot(RB_AUTOBOOT);
}
/* may not be reached in case of kill */