From 82ab0dae5e6bda2d49e2900f2d166462f6f25245 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Thu, 14 May 2015 10:40:14 +0200 Subject: [PATCH] libutempter: add portability patch for musl --- .../libutempter-remove-glibc-assumption.patch | 81 +++++++++++++++++++ srcpkgs/libutempter/template | 2 +- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/libutempter/patches/libutempter-remove-glibc-assumption.patch diff --git a/srcpkgs/libutempter/patches/libutempter-remove-glibc-assumption.patch b/srcpkgs/libutempter/patches/libutempter-remove-glibc-assumption.patch new file mode 100644 index 00000000000..bc9a46e7be3 --- /dev/null +++ b/srcpkgs/libutempter/patches/libutempter-remove-glibc-assumption.patch @@ -0,0 +1,81 @@ +diff -Naur utempter.c.orig utempter.c +--- utempter.c.orig 2010-11-04 13:14:53.000000000 -0400 ++++ 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); + } diff --git a/srcpkgs/libutempter/template b/srcpkgs/libutempter/template index 9f535885cd2..5b11a924272 100644 --- a/srcpkgs/libutempter/template +++ b/srcpkgs/libutempter/template @@ -1,7 +1,7 @@ # Template file for 'libutempter' pkgname=libutempter version=1.1.6 -revision=3 +revision=4 build_style=gnu-makefile short_desc="Library interface to record user sessions in utmp/wtmp files" maintainer="Juan RP "