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