git: 2546c543fd79 - main - reboot: Move extern for environ

From: Warner Losh <imp_at_FreeBSD.org>
Date: Sun, 18 Feb 2024 04:40:34 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=2546c543fd7955276388aae6f0869d2c9285ba59

commit 2546c543fd7955276388aae6f0869d2c9285ba59
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-02-18 04:30:48 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-18 04:39:42 +0000

    reboot: Move extern for environ
    
    envorin isn't defined in any header, and gcc is cranky with this inside
    a function, so move it to global scope. Both clang and gcc are now happy
    with this.
    
    Sponsored by:           Netflix
---
 sbin/reboot/reboot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index 550530ad079e..d215255487a7 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -51,6 +51,8 @@
 #include <unistd.h>
 #include <utmpx.h>
 
+extern char **environ;
+
 #define PATH_NEXTBOOT "/boot/nextboot.conf"
 
 static void usage(void) __dead2;
@@ -84,7 +86,6 @@ zfsbootcfg(const char *pool, bool force)
 	};
 	int rv, status;
 	pid_t p;
-	extern char **environ;
 
 	rv = posix_spawnp(&p, av[0], NULL, NULL, __DECONST(char **, av),
 	    environ);