From 82c654d4c5bd383caa6e6ebaa85b96af4fd641cf Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 6 Apr 2017 21:45:55 -0700 Subject: libutempter: Fix build with musl Signed-off-by: Khem Raj --- meta-oe/recipes-support/libutempter/libutempter.bb | 4 +- .../libutempter-remove-glibc-assumption.patch | 81 ++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-support/libutempter/libutempter/libutempter-remove-glibc-assumption.patch (limited to 'meta-oe/recipes-support/libutempter') diff --git a/meta-oe/recipes-support/libutempter/libutempter.bb b/meta-oe/recipes-support/libutempter/libutempter.bb index 0282ba5005..8c84cb376f 100644 --- a/meta-oe/recipes-support/libutempter/libutempter.bb +++ b/meta-oe/recipes-support/libutempter/libutempter.bb @@ -11,7 +11,9 @@ SRCREV = "3ef74fff310f09e2601e241b9f042cd39d591018" PV = "1.1.6-alt2+git${SRCPV}" SRC_URI = "git://git.altlinux.org/people/ldv/packages/libutempter.git \ - file://0001-Fix-macro-error.patch" + file://0001-Fix-macro-error.patch \ + file://libutempter-remove-glibc-assumption.patch \ + " S = "${WORKDIR}/git/${BPN}" diff --git a/meta-oe/recipes-support/libutempter/libutempter/libutempter-remove-glibc-assumption.patch b/meta-oe/recipes-support/libutempter/libutempter/libutempter-remove-glibc-assumption.patch new file mode 100644 index 0000000000..6ed93355bb --- /dev/null +++ b/meta-oe/recipes-support/libutempter/libutempter/libutempter-remove-glibc-assumption.patch @@ -0,0 +1,81 @@ +diff -Naur libutempter-1.1.6.orig/utempter.c libutempter-1.1.6/utempter.c +--- libutempter-1.1.6.orig/utempter.c 2010-11-04 13:14:53.000000000 -0400 ++++ libutempter-1.1.6/utempter.c 2014-06-20 16:37:09.762403323 -0400 +@@ -34,13 +34,7 @@ + #include + #include + +-#ifdef __GLIBC__ + # include +-#elif defined(__FreeBSD__) +-# include +-#else +-# error Unsupported platform +-#endif /* __GLIBC__ || __FreeBSD__ */ + + #define DEV_PREFIX "/dev/" + #define DEV_PREFIX_LEN (sizeof(DEV_PREFIX)-1) +@@ -106,17 +100,12 @@ + + static int + write_uwtmp_record(const char *user, const char *term, const char *host, +-#ifdef __GLIBC__ + pid_t pid, +-#endif + int add) + { + struct utmp ut; + struct timeval tv; +- +-#ifdef __GLIBC__ + size_t offset; +-#endif + + memset(&ut, 0, sizeof(ut)); + +@@ -128,8 +117,6 @@ + if (host) + strncpy(ut.ut_host, host, sizeof(ut.ut_host)); + +-#ifdef __GLIBC__ +- + offset = (strlen(term) <= sizeof(ut.ut_id)) ? 0 : + strlen(term) - sizeof(ut.ut_id); + strncpy(ut.ut_id, term + offset, sizeof(ut.ut_id)); +@@ -156,27 +143,6 @@ + + (void) updwtmp(_PATH_WTMP, &ut); + +-#elif defined(__FreeBSD__) +- +- ut.ut_time = tv.tv_sec; +- +- if (add) +- { +- login(&ut); +- } else +- { +- if (logout(term) != 1) +- { +-#ifdef UTEMPTER_DEBUG +- fprintf(stderr, "utempter: logout: %s\n", +- strerror(errno)); +-#endif +- exit(EXIT_FAILURE); +- } +- } +- +-#endif /* __GLIBC__ || __FreeBSD__ */ +- + #ifdef UTEMPTER_DEBUG + fprintf(stderr, + "utempter: DEBUG: utmp/wtmp record %s for terminal '%s'\n", +@@ -255,8 +221,6 @@ + validate_device(device); + + return write_uwtmp_record(pw->pw_name, device + DEV_PREFIX_LEN, host, +-#ifdef __GLIBC__ + pid, +-#endif + add); + } -- cgit 1.2.3-korg