diff options
| author | Warner Losh <imp@FreeBSD.org> | 2024-02-12 18:45:54 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2024-02-12 18:45:54 +0000 |
| commit | 9dcf6cbd83fdbf87feadd56b9e8f494e73fa5c39 (patch) | |
| tree | ae6ae85e24b4d33d60075dd8dc945b752ac01da4 /sbin | |
| parent | ecc834241fc3ab23990291e7e99fd05a34af05f1 (diff) | |
Diffstat (limited to 'sbin')
| -rw-r--r-- | sbin/reboot/reboot.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index 875f00c01ef9..a4be86a4983f 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -88,7 +88,7 @@ zfsbootcfg(const char *pool, bool force) } static void -write_nextboot(const char *fn, const char *env, const char *kernel, bool force) +write_nextboot(const char *fn, const char *env, bool force) { FILE *fp; struct statfs sfs; @@ -112,12 +112,11 @@ write_nextboot(const char *fn, const char *env, const char *kernel, bool force) fp = fopen(fn, "w"); if (fp == NULL) - E("Can't create %s to boot %s", fn, kernel); + E("Can't create %s", fn); - if (fprintf(fp,"%s%skernel=\"%s\"\n", + if (fprintf(fp,"%s%s", supported ? "nextboot_enable=\"YES\"\n" : "", - env != NULL ? env : "", - kernel) < 0) { + env != NULL ? env : "") < 0) { int e; e = errno; @@ -175,7 +174,6 @@ main(int argc, char *argv[]) const char *user, *kernel = NULL; char *env = NULL, *v; - if (strstr(getprogname(), "halt") != NULL) { dohalt = true; howto = RB_HALT; @@ -274,9 +272,10 @@ main(int argc, char *argv[]) errx(1, "%s is not a file", k); free(k); } - write_nextboot(PATH_NEXTBOOT, env, kernel, fflag); + add_env(&env, "kernel", kernel); } + write_nextboot(PATH_NEXTBOOT, env, fflag); /* Log the reboot. */ if (!lflag) { if ((user = getlogin()) == NULL) |
