elogind: update to 226.4.

This commit is contained in:
Enno Boland 2017-03-23 11:14:52 +01:00
parent 42c496f71a
commit 0c9d013022
14 changed files with 10 additions and 2723 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,273 +0,0 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
With parts from the musl C library
Copyright 2005-2014 Rich Felker, et al.
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stddef.h>
#include <string.h>
#include "parse-printf-format.h"
static const char *consume_nonarg(const char *fmt)
{
do {
if (*fmt == '\0')
return fmt;
} while (*fmt++ != '%');
return fmt;
}
static const char *consume_num(const char *fmt)
{
for (;*fmt >= '0' && *fmt <= '9'; fmt++)
/* do nothing */;
return fmt;
}
static const char *consume_argn(const char *fmt, size_t *arg)
{
const char *p = fmt;
size_t val = 0;
if (*p < '1' || *p > '9')
return fmt;
do {
val = 10*val + (*p++ - '0');
} while (*p >= '0' && *p <= '9');
if (*p != '$')
return fmt;
*arg = val;
return p+1;
}
static const char *consume_flags(const char *fmt)
{
while (1) {
switch (*fmt) {
case '#':
case '0':
case '-':
case ' ':
case '+':
case '\'':
case 'I':
fmt++;
continue;
}
return fmt;
}
}
enum state {
BARE,
LPRE,
LLPRE,
HPRE,
HHPRE,
BIGLPRE,
ZTPRE,
JPRE,
STOP
};
enum type {
NONE,
PTR,
INT,
UINT,
ULLONG,
LONG,
ULONG,
SHORT,
USHORT,
CHAR,
UCHAR,
LLONG,
SIZET,
IMAX,
UMAX,
PDIFF,
UIPTR,
DBL,
LDBL,
MAXTYPE
};
static const short pa_types[MAXTYPE] = {
[NONE] = PA_INT,
[PTR] = PA_POINTER,
[INT] = PA_INT,
[UINT] = PA_INT,
[ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
[LONG] = PA_INT | PA_FLAG_LONG,
[ULONG] = PA_INT | PA_FLAG_LONG,
[SHORT] = PA_INT | PA_FLAG_SHORT,
[USHORT] = PA_INT | PA_FLAG_SHORT,
[CHAR] = PA_CHAR,
[UCHAR] = PA_CHAR,
[LLONG] = PA_INT | PA_FLAG_LONG_LONG,
[SIZET] = PA_INT | PA_FLAG_LONG,
[IMAX] = PA_INT | PA_FLAG_LONG_LONG,
[UMAX] = PA_INT | PA_FLAG_LONG_LONG,
[PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
[UIPTR] = PA_INT | PA_FLAG_LONG,
[DBL] = PA_DOUBLE,
[LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
};
#define S(x) [(x)-'A']
#define E(x) (STOP + (x))
static const unsigned char states[]['z'-'A'+1] = {
{ /* 0: bare types */
S('d') = E(INT), S('i') = E(INT),
S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
S('c') = E(CHAR),S('C') = E(INT),
S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
S('m') = E(NONE),
S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
}, { /* 1: l-prefixed */
S('d') = E(LONG), S('i') = E(LONG),
S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
S('l') = LLPRE
}, { /* 2: ll-prefixed */
S('d') = E(LLONG), S('i') = E(LLONG),
S('o') = E(ULLONG),S('u') = E(ULLONG),
S('x') = E(ULLONG),S('X') = E(ULLONG),
S('n') = E(PTR)
}, { /* 3: h-prefixed */
S('d') = E(SHORT), S('i') = E(SHORT),
S('o') = E(USHORT),S('u') = E(USHORT),
S('x') = E(USHORT),S('X') = E(USHORT),
S('n') = E(PTR),
S('h') = HHPRE
}, { /* 4: hh-prefixed */
S('d') = E(CHAR), S('i') = E(CHAR),
S('o') = E(UCHAR),S('u') = E(UCHAR),
S('x') = E(UCHAR),S('X') = E(UCHAR),
S('n') = E(PTR)
}, { /* 5: L-prefixed */
S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
S('n') = E(PTR)
}, { /* 6: z- or t-prefixed (assumed to be same size) */
S('d') = E(PDIFF),S('i') = E(PDIFF),
S('o') = E(SIZET),S('u') = E(SIZET),
S('x') = E(SIZET),S('X') = E(SIZET),
S('n') = E(PTR)
}, { /* 7: j-prefixed */
S('d') = E(IMAX), S('i') = E(IMAX),
S('o') = E(UMAX), S('u') = E(UMAX),
S('x') = E(UMAX), S('X') = E(UMAX),
S('n') = E(PTR)
}
};
size_t parse_printf_format(const char *fmt, size_t n, int *types)
{
size_t i = 0;
size_t last = 0;
memset(types, 0, n);
while (1) {
size_t arg;
unsigned int state;
fmt = consume_nonarg(fmt);
if (*fmt == '\0')
break;
if (*fmt == '%') {
fmt++;
continue;
}
arg = 0;
fmt = consume_argn(fmt, &arg);
/* flags */
fmt = consume_flags(fmt);
/* width */
if (*fmt == '*') {
size_t warg = 0;
fmt = consume_argn(fmt+1, &warg);
if (warg == 0)
warg = ++i;
if (warg > last)
last = warg;
if (warg <= n && types[warg-1] == NONE)
types[warg-1] = INT;
} else
fmt = consume_num(fmt);
/* precision */
if (*fmt == '.') {
fmt++;
if (*fmt == '*') {
size_t parg = 0;
fmt = consume_argn(fmt+1, &parg);
if (parg == 0)
parg = ++i;
if (parg > last)
last = parg;
if (parg <= n && types[parg-1] == NONE)
types[parg-1] = INT;
} else {
if (*fmt == '-')
fmt++;
fmt = consume_num(fmt);
}
}
/* length modifier and conversion specifier */
state = BARE;
do {
unsigned char c = *fmt++;
if (c < 'A' || c > 'z')
continue;
state = states[state]S(c);
if (state == 0)
continue;
} while (state < STOP);
if (state == E(NONE))
continue;
if (arg == 0)
arg = ++i;
if (arg > last)
last = arg;
if (arg <= n)
types[arg-1] = state - STOP;
}
if (last > n)
last = n;
for (i = 0; i < last; i++)
types[i] = pa_types[types[i]];
return last;
}

View file

@ -1,58 +0,0 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
With parts from the GNU C Library
Copyright 1991-2014 Free Software Foundation, Inc.
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#pragma once
#include "config.h"
#ifdef HAVE_PRINTF_H
#include <printf.h>
#else
#include <stddef.h>
enum { /* C type: */
PA_INT, /* int */
PA_CHAR, /* int, cast to char */
PA_WCHAR, /* wide char */
PA_STRING, /* const char *, a '\0'-terminated string */
PA_WSTRING, /* const wchar_t *, wide character string */
PA_POINTER, /* void * */
PA_FLOAT, /* float */
PA_DOUBLE, /* double */
PA_LAST
};
/* Flag bits that can be set in a type returned by `parse_printf_format'. */
#define PA_FLAG_MASK 0xff00
#define PA_FLAG_LONG_LONG (1 << 8)
#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
#define PA_FLAG_LONG (1 << 9)
#define PA_FLAG_SHORT (1 << 10)
#define PA_FLAG_PTR (1 << 11)
size_t parse_printf_format(const char *fmt, size_t n, int *types);
#endif /* HAVE_PRINTF_H */

View file

@ -1,64 +0,0 @@
--- src/shared/label.c 2015-04-19 13:32:24.659347470 +0200
+++ src/shared/label.c 2017-03-04 13:41:05.953585324 +0100
@@ -25,9 +25,11 @@
#include "label.h"
int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
- int r, q;
+ int r = 0, q = 0;
+#ifdef HAVE_SELINUX
r = mac_selinux_fix(path, ignore_enoent, ignore_erofs);
+#endif
q = mac_smack_fix(path, ignore_enoent, ignore_erofs);
if (r < 0)
@@ -39,18 +41,22 @@
}
int mkdir_label(const char *path, mode_t mode) {
- int r;
+ int r = 0;
assert(path);
+#ifdef HAVE_SELINUX
r = mac_selinux_create_file_prepare(path, S_IFDIR);
if (r < 0)
return r;
+#endif
if (mkdir(path, mode) < 0)
r = -errno;
+#ifdef HAVE_SELINUX
mac_selinux_create_file_clear();
+#endif
if (r < 0)
return r;
@@ -59,19 +65,23 @@
}
int symlink_label(const char *old_path, const char *new_path) {
- int r;
+ int r = 0;
assert(old_path);
assert(new_path);
+#ifdef HAVE_SELINUX
r = mac_selinux_create_file_prepare(new_path, S_IFLNK);
if (r < 0)
return r;
+#endif
if (symlink(old_path, new_path) < 0)
r = -errno;
+#ifdef HAVE_SELINUX
mac_selinux_create_file_clear();
+#endif
if (r < 0)
return r;

View file

@ -1,25 +0,0 @@
--- src/login/logind-action.c 2015-08-29 11:16:20.584190227 +0200
+++ src/login/logind-action.c 2017-03-04 13:55:29.722627380 +0100
@@ -176,9 +176,9 @@
return wait_for_terminate_and_warn(helper, pid, true);
}
-static int write_mode(char **modes) {
+static int write_mode(const char **modes) {
int r = 0;
- char **mode;
+ const char **mode;
STRV_FOREACH(mode, modes) {
int k;
@@ -199,8 +199,8 @@
return r;
}
-static int write_state(FILE **f, char **states) {
- char **state;
+static int write_state(FILE **f, const char **states) {
+ const char **state;
int r = 0;
STRV_FOREACH(state, states) {

View file

@ -1,253 +0,0 @@
This library is a masterpiece of writing non-portable code.
The patches are trying to be minimally invasive and are, for
the most part, just simple macros replacing glibc extensions
with their POSIX counterparts.
The file src/musl_missing.h is included whereever the code
expects functions and constants which are specific to glibc.
--- src/libelogind/sd-bus/bus-message.c 2015-04-19 13:32:24.607347468 +0200
+++ src/libelogind/sd-bus/bus-message.c 2017-03-04 12:12:45.277329646 +0100
@@ -23,6 +23,7 @@
#include <fcntl.h>
#include <sys/mman.h>
+#include "musl_missing.h"
#include "util.h"
#include "utf8.h"
#include "strv.h"
--- src/libelogind/sd-bus/bus-objects.c 2015-04-19 13:32:24.611347468 +0200
+++ src/libelogind/sd-bus/bus-objects.c 2017-03-04 12:12:52.469343136 +0100
@@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "musl_missing.h"
#include "strv.h"
#include "set.h"
#include "bus-internal.h"
--- src/libelogind/sd-bus/bus-util.c 2015-04-19 13:32:24.611347468 +0200
+++ src/libelogind/sd-bus/bus-util.c 2017-03-04 12:13:00.357357928 +0100
@@ -21,6 +21,7 @@
#include <sys/socket.h>
+#include "musl_missing.h"
#include "sd-daemon.h"
#include "sd-event.h"
#include "util.h"
--- src/libelogind/sd-bus/sd-bus.c 2016-03-06 16:00:52.027398234 +0100
+++ src/libelogind/sd-bus/sd-bus.c 2017-03-04 12:13:08.163372562 +0100
@@ -27,6 +27,7 @@
#include <sys/mman.h>
#include <pthread.h>
+#include "musl_missing.h"
#include "util.h"
#include "macro.h"
#include "strv.h"
--- src/libelogind/sd-device/sd-device.c 2015-04-19 13:32:24.611347468 +0200
+++ src/libelogind/sd-device/sd-device.c 2017-03-04 12:35:03.255797997 +0100
@@ -22,6 +22,7 @@
#include <sys/types.h>
#include <net/if.h>
+#include "musl_missing.h"
#include "util.h"
#include "macro.h"
#include "path-util.h"
--- src/shared/arphrd-list.c 2017-03-04 15:31:15.633884536 +0100
+++ src/shared/arphrd-list.c 2017-03-04 15:32:05.646967582 +0100
@@ -22,6 +22,7 @@
#include <net/if_arp.h>
#include <string.h>
+#include "musl_missing.h"
#include "util.h"
#include "arphrd-list.h"
--- src/shared/cgroup-util.c 2016-03-06 16:00:52.183398132 +0100
+++ src/shared/cgroup-util.c 2017-03-04 13:22:38.379366996 +0100
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <ftw.h>
+#include "musl_missing.h"
#include "cgroup-util.h"
#include "set.h"
#include "macro.h"
--- src/shared/import-util.c 2015-04-19 13:32:24.659347470 +0200
+++ src/shared/import-util.c 2017-03-04 13:50:12.978234609 +0100
@@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "musl_missing.h"
#include "util.h"
#include "import-util.h"
--- src/shared/log.c 2015-04-19 13:32:24.659347470 +0200
+++ src/shared/log.c 2017-03-04 12:13:13.650382848 +0100
@@ -29,6 +29,11 @@
#include <stddef.h>
+#if defined(__GLIBC__)
#include <printf.h>
+#else
+#include "musl_missing.h"
+#include "parse-printf-format.h"
+#endif
#include "log.h"
#include "util.h"
#include "missing.h"
--- src/shared/mkdir.c 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/mkdir.c 2017-03-04 13:24:40.815495150 +0100
@@ -22,6 +22,7 @@
#include <string.h>
#include <errno.h>
+#include "musl_missing.h"
#include "util.h"
#include "path-util.h"
#include "mkdir.h"
--- src/shared/pager.c 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/pager.c 2017-03-04 13:10:55.917202529 +0100
@@ -25,6 +25,7 @@
#include <string.h>
#include <sys/prctl.h>
+#include "musl_missing.h"
#include "pager.h"
#include "util.h"
#include "macro.h"
--- src/shared/path-util.c 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/path-util.c 2017-03-04 12:13:29.919413335 +0100
@@ -27,6 +27,7 @@
#include <fcntl.h>
#include <sys/statvfs.h>
+#include "musl_missing.h"
#include "macro.h"
#include "util.h"
#include "log.h"
--- src/shared/socket-util.c 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/socket-util.c 2017-03-04 13:13:24.833441863 +0100
@@ -29,6 +29,7 @@
#include <stddef.h>
#include <netdb.h>
+#include "musl_missing.h"
#include "macro.h"
#include "path-util.h"
#include "util.h"
--- src/shared/strbuf.c 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/strbuf.c 2017-03-04 12:44:52.010758521 +0100
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
+#include "musl_missing.h"
#include "util.h"
#include "strbuf.h"
--- src/shared/uid-range.c 2015-04-19 13:32:24.667347471 +0200
+++ src/shared/uid-range.c 2017-03-04 13:46:38.443975396 +0100
@@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "musl_missing.h"
#include "util.h"
#include "uid-range.h"
--- src/shared/util.c 2015-04-19 13:32:24.667347471 +0200
+++ src/shared/util.c 2017-03-04 12:13:25.146404392 +0100
@@ -74,6 +74,7 @@
#include <sys/auxv.h>
#endif
+#include "musl_missing.h"
#include "config.h"
#include "macro.h"
#include "util.h"
--- /dev/null 2017-02-27 11:29:25.507373858 +0100
+++ src/musl_missing.h 2017-03-04 12:07:03.302685073 +0100
@@ -0,0 +1,65 @@
+/****************************************************************
+ * musl_missing.h - work around glibc extensions for musl libc.
+ *
+ * Implements glibc functions missing in musl libc as macros.
+ * Is to be included where these functions are used.
+ * Also defines some glibc only constants as either 0 or
+ * as found in the corresponding glibc header file.
+ *
+ * Juergen Buchmueller <pullmoll@t-online.de> for Void Linux
+ * Public Domain; no warranties whatsoever. Thank you Mr. P.
+ *
+ ****************************************************************/
+
+#if !defined(__GLIBC__)
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/*
+ * Possibly TODO according to http://man7.org/linux/man-pages/man3/getenv.3.html
+ * + test if the process's effective user ID does not match its real user ID or
+ * the process's effective group ID does not match its real group ID;
+ * typically this is the result of executing a set-user-ID or set-
+ * group-ID program. Is calling issetugid() sufficient here?
+ * + test if the effective capability bit was set on the executable file
+ * + test if the process has a nonempty permitted capability set
+ */
+#define secure_getenv(name) \
+ (issetugid() ? NULL : getenv(name))
+
+/* Poor man's basename */
+#define basename(path) \
+ (strrchr(path, '/') ? strrchr(path, '/')+1 : path)
+
+/* strndupa may already be defined in another compatibility header */
+#if !defined(strndupa)
+#define strndupa(src, n) \
+ (__extension__ ({const char *in = (src); \
+ size_t len = strnlen(in, (n)) + 1; \
+ char *out = (char *) alloca(len); \
+ out[len-1] = '\0'; \
+ (char *) memcpy(out, in, len-1);}) \
+ )
+#endif
+
+/* See http://man7.org/linux/man-pages/man3/canonicalize_file_name.3.html */
+#define canonicalize_file_name(path) \
+ realpath(path, NULL)
+
+typedef int (*__compar_fn_t)(const void *, const void *);
+
+/* GLOB_BRACE is another glibc extension - ignore it for musl libc */
+#define GLOB_BRACE 0
+
+/* getnameinfo(3) glibc extensions are undefined in musl libc */
+#define NI_IDN 0
+#define NI_IDN_USE_STD3_ASCII_RULES 0
+
+/* Taken from glibc's net/if_arp.h */
+#if !defined(ARPHRD_IEEE802154_PHY)
+#define ARPHRD_IEEE802154_PHY 805 /* IEEE 802.15.4 PHY header. */
+#endif
+
+#endif /* !defined(__GLIBC__) */
--- Makefile.am 2016-03-06 16:00:51.919398304 +0100
+++ Makefile.am 2017-03-04 13:06:34.982792357 +0100
@@ -482,7 +482,9 @@
src/shared/import-util.c \
src/shared/import-util.h \
src/shared/sysctl-util.c \
- src/shared/sysctl-util.h
+ src/shared/sysctl-util.h \
+ src/shared/parse-printf-format.c \
+ src/shared/parse-printf-format.h
nodist_libelogind_shared_la_SOURCES = \
src/shared/errno-from-name.h \

View file

@ -1,55 +0,0 @@
Using the libc program_invocation_short_name results in a linker error:
/usr/bin/ld.gold: error: src/login/loginctl.o: cannot make copy relocation
for protected symbol 'program_invocation_short_name', defined in
/usr/lib/gcc/x86_64-linux-musl/6.3.0/../../../../lib/libc.so
Replace it with basename(argv[0]) which gives the same result.
--- src/login/inhibit.c 2015-04-19 13:32:24.639347469 +0200
+++ src/login/inhibit.c 2017-03-04 14:13:27.885132151 +0100
@@ -124,7 +125,8 @@
return 0;
}
-static void help(void) {
+static void help(int argc, char* argv[]) {
+ char* short_name = basename(argv[0]);
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Execute a process while inhibiting shutdown/sleep/idle.\n\n"
" -h --help Show this help\n"
@@ -137,7 +139,7 @@
" --why=STRING A descriptive string why is being inhibited\n"
" --mode=MODE One of block or delay\n"
" --list List active inhibitors\n"
- , program_invocation_short_name);
+ , short_name);
}
static int parse_argv(int argc, char *argv[]) {
@@ -172,7 +174,7 @@
switch (c) {
case 'h':
- help();
+ help(argc, argv);
return 0;
case ARG_VERSION:
--- src/login/loginctl.c 2015-09-01 13:12:13.079341932 +0200
+++ src/login/loginctl.c 2017-03-04 14:07:33.971586311 +0100
@@ -1395,6 +1394,7 @@
}
static int help(int argc, char *argv[], void *userdata) {
+ char* short_name = basename(argv[0]);
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Send control commands to or query the login manager.\n\n"
@@ -1446,7 +1446,7 @@
" suspend Suspend the machine to memory\n"
" hibernate Suspend the machine to disk\n"
" hybrid-sleep Suspend the machine to memory and disk\n"
- , program_invocation_short_name);
+ , short_name);
return 0;
}

View file

@ -1,10 +0,0 @@
--- src/shared/selinux-util.h 2015-04-19 13:32:24.663347471 +0200
+++ src/shared/selinux-util.h 2017-03-04 13:44:22.577814237 +0100
@@ -21,6 +21,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <sys/types.h>
#include <sys/socket.h>
#include <stdbool.h>

View file

@ -1,15 +0,0 @@
--- src/libelogind/sd-bus/bus-error.c 2015-04-20 21:59:54.600440290 +0200
+++ src/libelogind/sd-bus/bus-error.c 2017-03-04 12:29:27.793186294 +0100
@@ -378,7 +378,12 @@
return;
errno = 0;
+#if defined(__GLIBC__)
x = strerror_r(error, m, k);
+#else
+ /* int strerror_r (int, char *, size_t); */
+ x = strerror_r(error, m, k) < 0 ? strdup("strerror_r() failed") : m;
+#endif
if (errno == ERANGE || strlen(x) >= k - 1) {
free(m);
k *= 2;

View file

@ -1,11 +0,0 @@
--- src/login/loginctl.c 2017-03-05 12:42:33.677495884 +0100
+++ src/login/loginctl.c 2017-03-05 12:43:52.330545359 +0100
@@ -1491,7 +1491,7 @@
switch (c) {
case 'h':
- help(0, NULL, NULL);
+ help(argc, argv, NULL);
return 0;
case ARG_VERSION:

View file

@ -1,13 +0,0 @@
--- src/shared/util.h.orig 2017-03-05 17:12:46.654974564 +0100
+++ src/shared/util.h 2017-03-05 17:14:11.998704156 +0100
@@ -1041,7 +1041,11 @@ union inotify_event_buffer {
uint8_t raw[INOTIFY_EVENT_MAX];
};
+#ifdef __GLIBC__
#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)
+#else
+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0)
+#endif
int ptsname_malloc(int fd, char **ret);

View file

@ -1,129 +0,0 @@
From 1ca40c077cd9a08f96a559ba51e8dba230298c4d Mon Sep 17 00:00:00 2001
From: Michael Palimaka <kensington@gentoo.org>
Date: Sun, 19 Jun 2016 01:56:56 +1000
Subject: [PATCH] Update org.freedesktop.login1.conf
This mirrors an upstream change opening up all of logind's bus calls to
unprivileged users via polkit.
See systemd/systemd/issues/471.
Closes #3.
---
src/login/org.freedesktop.login1.conf | 68 +++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/src/login/org.freedesktop.login1.conf b/src/login/org.freedesktop.login1.conf
index 1318328..2e67e3d 100644
--- src/login/org.freedesktop.login1.conf
+++ src/login/org.freedesktop.login1.conf
@@ -90,6 +90,42 @@
<allow send_destination="org.freedesktop.login1"
send_interface="org.freedesktop.login1.Manager"
+ send_member="LockSession"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
+ send_member="UnlockSession"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
+ send_member="LockSessions"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
+ send_member="UnlockSessions"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
+ send_member="KillSession"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
+ send_member="KillUser"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
+ send_member="TerminateSession"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
+ send_member="TerminateUser"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
+ send_member="TerminateSeat"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
send_member="PowerOff"/>
<allow send_destination="org.freedesktop.login1"
@@ -130,6 +166,10 @@
<allow send_destination="org.freedesktop.login1"
send_interface="org.freedesktop.login1.Manager"
+ send_member="SetWallMessage"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Manager"
send_member="AttachDevice"/>
<allow send_destination="org.freedesktop.login1"
@@ -138,6 +178,10 @@
<allow send_destination="org.freedesktop.login1"
send_interface="org.freedesktop.login1.Seat"
+ send_member="Terminate"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Seat"
send_member="ActivateSession"/>
<allow send_destination="org.freedesktop.login1"
@@ -154,14 +198,30 @@
<allow send_destination="org.freedesktop.login1"
send_interface="org.freedesktop.login1.Session"
+ send_member="Terminate"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
send_member="Activate"/>
<allow send_destination="org.freedesktop.login1"
send_interface="org.freedesktop.login1.Session"
+ send_member="Lock"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
+ send_member="Unlock"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
send_member="SetIdleHint"/>
<allow send_destination="org.freedesktop.login1"
send_interface="org.freedesktop.login1.Session"
+ send_member="Kill"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
send_member="TakeControl"/>
<allow send_destination="org.freedesktop.login1"
@@ -180,6 +240,14 @@
send_interface="org.freedesktop.login1.Session"
send_member="PauseDeviceComplete"/>
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.User"
+ send_member="Terminate"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.User"
+ send_member="Kill"/>
+
<allow receive_sender="org.freedesktop.login1"/>
</policy>

View file

@ -1,55 +0,0 @@
--- src/shared/errno-list.c.orig 2017-01-13 21:53:06.171441950 +0100
+++ src/shared/errno-list.c 2017-01-13 21:53:44.491417473 +0100
@@ -25,7 +25,7 @@
#include "errno-list.h"
static const struct errno_name* lookup_errno(register const char *str,
- register unsigned int len);
+ register size_t len);
#include "errno-to-name.h"
#include "errno-from-name.h"
--- src/shared/af-list.c.orig 2017-01-13 21:55:14.941359697 +0100
+++ src/shared/af-list.c 2017-01-13 21:56:15.967320716 +0100
@@ -25,7 +25,7 @@
#include "util.h"
#include "af-list.h"
-static const struct af_name* lookup_af(register const char *str, register unsigned int len);
+static const struct af_name* lookup_af(register const char *str, register size_t len);
#include "af-to-name.h"
#include "af-from-name.h"
--- src/shared/cap-list.c.orig 2017-01-13 21:59:05.416212480 +0100
+++ src/shared/cap-list.c 2017-01-13 21:59:22.154201788 +0100
@@ -25,7 +25,7 @@
#include "cap-list.h"
#include "missing.h"
-static const struct capability_name* lookup_capability(register const char *str, register unsigned int len);
+static const struct capability_name* lookup_capability(register const char *str, register size_t len);
#include "cap-to-name.h"
#include "cap-from-name.h"
--- src/shared/arphrd-list.c.orig 2017-01-13 22:01:38.040114990 +0100
+++ src/shared/arphrd-list.c 2017-01-13 22:01:53.482105126 +0100
@@ -25,7 +25,7 @@
#include "util.h"
#include "arphrd-list.h"
-static const struct arphrd_name* lookup_arphrd(register const char *str, register unsigned int len);
+static const struct arphrd_name* lookup_arphrd(register const char *str, register size_t len);
#include "arphrd-to-name.h"
#include "arphrd-from-name.h"
--- src/login/logind.h.orig 2017-01-13 22:11:22.760741496 +0100
+++ src/login/logind.h 2017-01-13 22:11:32.259735429 +0100
@@ -163,7 +163,7 @@ int manager_send_changed(Manager *manage
int manager_dispatch_delayed(Manager *manager);
/* gperf lookup function */
-const struct ConfigPerfItem* logind_gperf_lookup(const char *key, unsigned length);
+const struct ConfigPerfItem* logind_gperf_lookup(const char *key, size_t length);
int manager_watch_busname(Manager *manager, const char *name);
void manager_drop_busname(Manager *manager, const char *name);

View file

@ -1,35 +1,26 @@
# Template file for 'elogind'
pkgname=elogind
version=219.14
revision=2
version=226.4
revision=1
build_style=gnu-configure
hostmakedepends="automake libxslt intltool libtool pkg-config gperf"
hostmakedepends="automake libxslt intltool libtool pkg-config gperf docbook-xsl"
makedepends="libcap-devel libmount-devel libseccomp-devel libblkid-devel pam-devel gettext-devel eudev-libudev-devel glib-devel"
depends="dbus"
short_desc="Standalone logind fork"
maintainer="Enno Boland <gottox@voidlinux.eu>"
license="GPL-2, LGPL-2, MIT"
homepage="https://github.com/andywingo/elogind"
distfiles="https://wingolog.org/pub/elogind/elogind-$version.tar.xz"
checksum=9dc150071a3f4c1ad1c989a7a143c2d41a2d571c643b92090e36a5d0396193c9
homepage="https://github.com/elogind/elogind"
distfiles="https://github.com/$pkgname/$pkgname/archive/v$version.tar.gz"
checksum=585ac8746cd81a74f47b4e93cb5f000494da4104ad53da0bae023e1758d0456d
LDFLAGS="-lrt"
conf_files="/etc/elogind/logind.conf"
pre_configure() {
vinstall $FILESDIR/elogind.wrapper 755 usr/libexec/elogind
autoreconf -fi
intltoolize
sed -i -e "s#^Exec=/bin/false#Exec=/usr/libexec/elogind/elogind.wrapper#" \
src/login/org.freedesktop.login1.service
# Copy an implementation of glibc printf.h for use with musl libc
cp -p ${FILESDIR}/parse-printf-format.{c,h} src/shared/
}
post_configure() {
case "$XBPS_TARGET_MACHINE" in
*-musl) # We do have an implementation of secure_getenv(3) through a macro...
sed -i config.h \
-e 's;/\* #undef HAVE_SECURE_GETENV \*/;#define HAVE_SECURE_GETENV 1;'
;;
esac
}
post_install() {
@ -38,6 +29,7 @@ post_install() {
ln -sr $DESTDIR/usr/include/elogind $DESTDIR/usr/include/systemd
vinstall ./src/systemd/sd-id128.h 644 usr/include
vinstall ./src/systemd/_sd-common.h 644 usr/include
vinstall $FILESDIR/elogind.wrapper 755 usr/libexec/elogind
vlicense LICENSE.MIT
}