xorg.xdm: fix build w/glibc-2.36

Failing Hydra build: https://hydra.nixos.org/build/193323749
This commit is contained in:
Maximilian Bosch 2022-10-09 11:16:11 +02:00
parent 5f0b5cc16e
commit 7046f09fe4
No known key found for this signature in database
GPG Key ID: 9A6EEA275CA5BE0A
2 changed files with 30 additions and 0 deletions

View File

@ -164,6 +164,7 @@ self: super:
});
xdm = super.xdm.overrideAttrs (attrs: {
patches = (attrs.patches or []) ++ [ ./xdm-fix-header-inclusion.patch ];
buildInputs = attrs.buildInputs ++ [ libxcrypt ];
configureFlags = attrs.configureFlags or [] ++ [
"ac_cv_path_RAWCPP=${stdenv.cc.targetPrefix}cpp"

View File

@ -0,0 +1,29 @@
On glibc-2.36 this fails with
genauth.c:45:12: fatal error: bsd/stdlib.h: No such file or directory
45 | # include <bsd/stdlib.h>
| ^~~~~~~~~~~~~~
This is because the file will be included if HAVE_ARC4RANDOM is true and `__linux__` is set.
However, this is wrong: arc4random is now defined in glibc-2.36 and thus stdlib.h must be included
even though HAVE_ARC4RANDOM is true.
diff --git a/xdm/genauth.c b/xdm/genauth.c
index cd2ad61..74d0ae1 100644
--- a/xdm/genauth.c
+++ b/xdm/genauth.c
@@ -40,13 +40,7 @@ from The Open Group.
#include <errno.h>
-#ifdef HAVE_ARC4RANDOM
-# ifdef __linux__
-# include <bsd/stdlib.h>
-# else
-# include <stdlib.h>
-# endif
-#endif
+#include <stdlib.h>
#include <time.h>
#define Time_t time_t