[Buildroot] [PATCH] host-mkpasswd: fix crash on Fedora 28 build host

Stefan Becker chemobejk at gmail.com
Wed May 2 09:05:08 UTC 2018


crypt() is an optional glibc feature. Some distros, like Fedora 28, are
phasing it out to be replaced with libxcrypt [1]. Unfortunately this
change is only ABI compatible, not source code compatible, i.e. the code
will compile with warnings about undefined crypt(), but the resulting
binary will crash.

Follow the guidance in the Fedora bug and include crypt.h when
_XOPEN_CRYPT is not defined.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1566464

Signed-off-by: Stefan Becker <chemobejk at gmail.com>
---
 package/mkpasswd/mkpasswd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/mkpasswd/mkpasswd.c b/package/mkpasswd/mkpasswd.c
index 5820f32501..fd16230468 100644
--- a/package/mkpasswd/mkpasswd.c
+++ b/package/mkpasswd/mkpasswd.c
@@ -44,6 +44,11 @@
 #include <sys/time.h>
 #endif
 
+/* glibc without crypt() */
+#ifndef _XOPEN_CRYPT
+#include <crypt.h>
+#endif
+
 /* Application-specific */
 #include "utils.h"
 
-- 
2.17.0



More information about the buildroot mailing list