Merge pull request #235487 from reckenrode/system_cmds-clang-fix

darwin.system_cmds: fix build with clang 16

authored by toonn and committed by GitHub b7ed52e2 eab5d792

+54 -1
+6 -1
pkgs/os-specific/darwin/apple-source-releases/system_cmds/default.nix
··· 30 30 "-DAU_SESSION_FLAG_HAS_AUTHENTICATED=0x4000" 31 31 ] ++ lib.optional (!stdenv.isLinux) " -D__FreeBSD__ "); 32 32 33 - patchPhase = '' 33 + patches = [ 34 + # Fix implicit declarations that cause builds to fail when built with clang 16. 35 + ./fix-implicit-declarations.patch 36 + ]; 37 + 38 + postPatch = '' 34 39 substituteInPlace login.tproj/login.c \ 35 40 --replace bsm/audit_session.h bsm/audit.h 36 41 substituteInPlace login.tproj/login_audit.c \
+48
pkgs/os-specific/darwin/apple-source-releases/system_cmds/fix-implicit-declarations.patch
··· 1 + diff -ur a/getty.tproj/main.c b/getty.tproj/main.c 2 + --- a/getty.tproj/main.c 2008-06-10 14:50:19.000000000 -0400 3 + +++ b/getty.tproj/main.c 2023-05-31 18:06:40.121028558 -0400 4 + @@ -67,6 +67,7 @@ 5 + #include <syslog.h> 6 + #include <termios.h> 7 + #include <time.h> 8 + +#include <util.h> 9 + #include <unistd.h> 10 + 11 + #ifdef __APPLE__ 12 + @@ -152,7 +153,7 @@ 13 + static void putpad(const char *); 14 + static void puts(const char *); 15 + static void timeoverrun(int); 16 + -static char *getline(int); 17 + +static char *get_line(int); 18 + static void setttymode(int); 19 + static int opentty(const char *, int); 20 + 21 + @@ -352,7 +353,7 @@ 22 + if ((fd = open(IF, O_RDONLY)) != -1) { 23 + char * cp; 24 + 25 + - while ((cp = getline(fd)) != NULL) { 26 + + while ((cp = get_line(fd)) != NULL) { 27 + putf(cp); 28 + } 29 + close(fd); 30 + @@ -744,7 +745,7 @@ 31 + 32 + 33 + static char * 34 + -getline(int fd) 35 + +get_line(int fd) 36 + { 37 + int i = 0; 38 + static char linebuf[512]; 39 + --- a/newgrp.tproj/newgrp.c 2021-10-06 01:38:52.000000000 -0400 40 + +++ b/newgrp.tproj/newgrp.c 2023-05-31 22:26:50.656157841 -0400 41 + @@ -47,6 +47,7 @@ 42 + #include <string.h> 43 + #include <unistd.h> 44 + #ifdef __APPLE__ 45 + +#include <membership.h> 46 + #include <paths.h> 47 + #endif /* __APPLE__ */ 48 + static void addgroup(const char *grpname);