Accepting request 290056 from Base:System

Submit systemd to a staging of it's own - retest post revert

OBS-URL: https://build.opensuse.org/request/show/290056
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=218
This commit is contained in:
Dominique Leuenberger 2015-03-27 08:39:40 +00:00 committed by Git OBS Bridge
commit 40ca0722f5
517 changed files with 3871 additions and 110760 deletions

View File

@ -1,110 +0,0 @@
Based on 874bc134ac6504c45e94174e37af13ff21a6bfe2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 14 Jul 2014 16:53:23 -0400
Subject: [PATCH] Clear up confusion wrt. ENTRY_SIZE_MAX and DATA_SIZE_MAX
Define DATA_SIZE_MAX to mean the maximum size of a single
field, and ENTRY_SIZE_MAX to mean the size of the whole
entry, with some rough calculation of overhead over the payload.
Check if entries are not too big when processing native journal
messages.
---
src/journal/coredump.c | 6 +++---
src/journal/journald-native.c | 25 +++++++++++++++++++++----
2 files changed, 24 insertions(+), 7 deletions(-)
--- src/journal/coredump.c
+++ src/journal/coredump.c 2014-07-16 13:02:54.438235659 +0000
@@ -38,10 +38,10 @@
#include "cgroup-util.h"
/* Few programs have less than 3MiB resident */
-#define COREDUMP_MIN_START (3*1024*1024)
+#define COREDUMP_MIN_START (3*1024*1024u)
/* Make sure to not make this larger than the maximum journal entry
- * size. See ENTRY_SIZE_MAX in journald-native.c. */
-#define COREDUMP_MAX (767*1024*1024)
+ * size. See DATA_SIZE_MAX in journald-native.c. */
+#define COREDUMP_MAX (1024*1024*767u)
enum {
ARG_PID = 1,
--- src/journal/journald-native.c
+++ src/journal/journald-native.c 2014-07-16 12:50:45.000000000 +0000
@@ -34,8 +34,8 @@
/* Make sure not to make this smaller than the maximum coredump
* size. See COREDUMP_MAX in coredump.c */
-#define ENTRY_SIZE_MAX (1024*1024*768)
-#define DATA_SIZE_MAX (1024*1024*768)
+#define ENTRY_SIZE_MAX (1024*1024*770u)
+#define DATA_SIZE_MAX (1024*1024*768u)
static bool valid_user_field(const char *p, size_t l) {
const char *a;
@@ -86,7 +86,7 @@ void server_process_native_message(
struct iovec *iovec = NULL;
unsigned n = 0, j, tn = (unsigned) -1;
const char *p;
- size_t remaining, m = 0;
+ size_t remaining, m = 0, entry_size = 0;
int priority = LOG_INFO;
char *identifier = NULL, *message = NULL;
pid_t object_pid = 0;
@@ -110,9 +110,17 @@ void server_process_native_message(
if (e == p) {
/* Entry separator */
+
+ if (entry_size + n + 1 > ENTRY_SIZE_MAX) { /* data + separators + trailer */
+ log_debug("Entry is too big with %u properties and %zu bytes, ignoring.",
+ n, entry_size);
+ continue;
+ }
+
server_dispatch_message(s, iovec, n, m, ucred, tv, label, label_len, NULL, priority, object_pid);
n = 0;
priority = LOG_INFO;
+ entry_size = 0;
p++;
remaining--;
@@ -150,6 +158,7 @@ void server_process_native_message(
iovec[n].iov_base = (char*) p;
iovec[n].iov_len = l;
n++;
+ entry_size += iovec[n].iov_len;
/* We need to determine the priority
* of this entry for the rate limiting
@@ -218,7 +227,7 @@ void server_process_native_message(
l = le64toh(l_le);
if (l > DATA_SIZE_MAX) {
- log_debug("Received binary data block too large, ignoring.");
+ log_debug("Received binary data block of %zu bytes is too large, ignoring.", l);
break;
}
@@ -242,6 +251,7 @@ void server_process_native_message(
iovec[n].iov_base = k;
iovec[n].iov_len = (e - p) + 1 + l;
n++;
+ entry_size += iovec[n].iov_len;
} else
free(k);
@@ -255,6 +265,13 @@ void server_process_native_message(
tn = n++;
IOVEC_SET_STRING(iovec[tn], "_TRANSPORT=journal");
+ entry_size += strlen("_TRANSPORT=journal");
+
+ if (entry_size + n + 1 > ENTRY_SIZE_MAX) { /* data + separators + trailer */
+ log_debug("Entry is too big with %u properties and %zu bytes, ignoring.",
+ n, entry_size);
+ goto finish;
+ }
if (message) {
if (s->forward_to_syslog)

View File

@ -1,21 +0,0 @@
Based on 000f6e5667eb4f73e137cbd0d7395a9f9db7728a Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 26 May 2014 20:09:45 +0200
Subject: [PATCH] Do not unescape unit names in [Install] section
https://bugs.freedesktop.org/show_bug.cgi?id=49316
---
src/shared/conf-parser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- src/shared/conf-parser.c
+++ src/shared/conf-parser.c 2014-05-27 07:36:20.478236631 +0000
@@ -723,7 +723,7 @@ int config_parse_strv(const char *unit,
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
_cleanup_free_ char *n;
- n = cunescape_length(w, l);
+ n = strndup(w, l);
if (!n)
return log_oom();

View File

@ -1,25 +0,0 @@
From 5effdfa831d75306fc0ff9b47d39997e4ae87f16 Mon Sep 17 00:00:00 2001
From: Michael Meeks <michael.meeks@collabora.com>
Date: Tue, 11 Feb 2014 14:42:26 +0000
Subject: [PATCH] Don't snprintf a potentially NULL pointer.
---
src/shared/log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/log.c b/src/shared/log.c
index 2a075ff..d6b138f 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -479,7 +479,7 @@ static int log_do_header(char *header, size_t size,
func ? "CODE_FUNCTION=" : "",
func ? LINE_MAX : 0, func,
func ? "\n" : "",
- object ? object_name : "",
+ object_name ? object_name : "",
object ? LINE_MAX : 0, object, /* %.0s means no output */
object ? "\n" : "",
program_invocation_short_name);
--
1.8.4.5

View File

@ -1,28 +0,0 @@
From 8100c1a8f58b2fb5d97e156420a7e16562e93bc4 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Sun, 2 Mar 2014 23:37:39 -0500
Subject: [PATCH] Fix systemd-stdio-bridge symlink
The symlink is created in bindir (/usr/bin), and points to a binary
which lives in rootlibexecdir (/lib/systemd or /usr/lib/systemd). A
relative symlink does not work here.
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git Makefile.am Makefile.am
index 38445fb..e7134a2 100644
--- Makefile.am
+++ Makefile.am
@@ -1978,7 +1978,7 @@ systemd_bus_proxyd_LDADD = \
bus-proxyd-install-hook:
$(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
- $(AM_V_LN)$(LN_S) -f ../lib/systemd/systemd-bus-proxyd $(DESTDIR)$(bindir)/systemd-stdio-bridge
+ $(AM_V_LN)$(LN_S) -f $(rootlibexecdir)/systemd-bus-proxyd $(DESTDIR)$(bindir)/systemd-stdio-bridge
bus-proxyd-uninstall-hook:
rm -f $(DESTDIR)$(bindir)/systemd-stdio-bridge
--
1.7.9.2

View File

@ -1,31 +0,0 @@
From 493d521d9ffe706741665a88ea14929913ea2eaf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 23 Sep 2014 09:22:40 -0400
Subject: [PATCH] Fix warning about unused variable with !SELINUX
src/shared/label.c:255:15: warning: unused variable 'l' [-Wunused-variable]
char *l = NULL;
^
---
src/shared/label.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git src/shared/label.c src/shared/label.c
index 02b41f0..b6af38d 100644
--- src/shared/label.c
+++ src/shared/label.c
@@ -252,9 +252,10 @@ fail:
int label_get_our_label(char **label) {
int r = -EOPNOTSUPP;
- char *l = NULL;
#ifdef HAVE_SELINUX
+ char *l = NULL;
+
r = getcon(&l);
if (r < 0)
return r;
--
1.7.9.2

View File

@ -1,25 +1,29 @@
---
rules/99-systemd.rules.in | 2
src/core/manager.c | 24 ++++++++--
src/shared/util.c | 101 ++++++++++++++++++++++++++++++++++++++++++++--
src/core/manager.c | 24 ++++++++---
src/shared/util.c | 99 ++++++++++++++++++++++++++++++++++++++++++++--
src/shared/util.h | 1
4 files changed, 118 insertions(+), 10 deletions(-)
4 files changed, 116 insertions(+), 10 deletions(-)
--- systemd-208/rules/99-systemd.rules.in
+++ systemd-208/rules/99-systemd.rules.in 2014-02-05 10:34:17.346235540 +0000
Index: systemd/rules/99-systemd.rules.in
===================================================================
--- systemd.orig/rules/99-systemd.rules.in
+++ systemd/rules/99-systemd.rules.in
@@ -7,7 +7,7 @@
ACTION=="remove", GOTO="systemd_end"
-SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*", TAG+="systemd"
-SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty[0-9]*", TAG+="systemd"
+SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty*", TAG+="systemd"
KERNEL=="vport*", TAG+="systemd"
--- systemd-210/src/core/manager.c
+++ systemd-210/src/core/manager.c 2014-04-30 10:51:43.398735332 +0000
@@ -110,7 +110,7 @@ static int manager_watch_jobs_in_progres
Index: systemd/src/core/manager.c
===================================================================
--- systemd.orig/src/core/manager.c
+++ systemd/src/core/manager.c
@@ -113,7 +113,7 @@ static int manager_watch_jobs_in_progres
#define CYLON_BUFFER_EXTRA (2*(sizeof(ANSI_RED_ON)-1) + sizeof(ANSI_HIGHLIGHT_RED_ON)-1 + 2*(sizeof(ANSI_HIGHLIGHT_OFF)-1))
@ -28,7 +32,7 @@
char *p = buffer;
assert(buflen >= CYLON_BUFFER_EXTRA + width + 1);
@@ -119,12 +119,14 @@ static void draw_cylon(char buffer[], si
@@ -122,12 +122,14 @@ static void draw_cylon(char buffer[], si
if (pos > 1) {
if (pos > 2)
p = mempset(p, ' ', pos-2);
@ -45,7 +49,7 @@
*p++ = '*';
}
@@ -135,7 +137,8 @@ static void draw_cylon(char buffer[], si
@@ -138,7 +140,8 @@ static void draw_cylon(char buffer[], si
*p++ = '*';
if (pos < width-1)
p = mempset(p, ' ', width-1-pos);
@ -55,7 +59,7 @@
}
}
@@ -150,6 +153,7 @@ void manager_flip_auto_status(Manager *m
@@ -155,6 +158,7 @@ void manager_flip_auto_status(Manager *m
}
static void manager_print_jobs_in_progress(Manager *m) {
@ -63,7 +67,7 @@
_cleanup_free_ char *job_of_n = NULL;
Iterator i;
Job *j;
@@ -174,10 +178,20 @@ static void manager_print_jobs_in_progre
@@ -180,10 +184,20 @@ static void manager_print_jobs_in_progre
assert(counter == print_nr + 1);
assert(j);
@ -85,9 +89,11 @@
m->jobs_in_progress_iteration++;
--- systemd-210/src/shared/util.c
+++ systemd-210/src/shared/util.c 2014-04-30 10:39:17.154736438 +0000
@@ -2886,6 +2886,7 @@ int status_vprintf(const char *status, b
Index: systemd/src/shared/util.c
===================================================================
--- systemd.orig/src/shared/util.c
+++ systemd/src/shared/util.c
@@ -3212,6 +3212,7 @@ int status_vprintf(const char *status, b
struct iovec iovec[6] = {};
int n = 0;
static bool prev_ephemeral;
@ -95,12 +101,12 @@
assert(format);
@@ -2899,6 +2900,41 @@ int status_vprintf(const char *status, b
@@ -3225,6 +3226,41 @@ int status_vprintf(const char *status, b
if (fd < 0)
return fd;
+ if (_unlikely_(is_ansi_console < 0))
+ is_ansi_console = (int)ansi_console(fd);
+ is_ansi_console = ansi_console(fd);
+
+ if (status && !is_ansi_console) {
+ const char *esc, *ptr;
@ -137,7 +143,7 @@
if (ellipse) {
char *e;
size_t emax, sl;
@@ -2921,8 +2957,12 @@ int status_vprintf(const char *status, b
@@ -3247,8 +3283,12 @@ int status_vprintf(const char *status, b
}
}
@ -152,7 +158,7 @@
prev_ephemeral = ephemeral;
if (status) {
@@ -3169,12 +3209,47 @@ void columns_lines_cache_reset(int signu
@@ -3504,8 +3544,22 @@ void columns_lines_cache_reset(int signu
bool on_tty(void) {
static int cached_on_tty = -1;
@ -176,6 +182,9 @@
return cached_on_tty;
}
@@ -3523,6 +3577,27 @@ int files_same(const char *filea, const
a.st_ino == b.st_ino;
}
+bool ansi_console(int fd) {
+ static int cached_ansi_console = -1;
@ -199,13 +208,13 @@
+}
+
int running_in_chroot(void) {
struct stat a = {}, b = {};
int ret;
@@ -3630,7 +3705,25 @@ bool tty_is_vc_resolve(const char *tty)
@@ -4006,7 +4081,23 @@ bool tty_is_vc_resolve(const char *tty)
const char *default_term_for_tty(const char *tty) {
assert(tty);
- return tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt102";
- return tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt220";
+ if (tty_is_vc_resolve(tty))
+ return "TERM=linux";
+
@ -221,16 +230,16 @@
+ if (streq(mode, "3270"))
+ return "TERM=ibm327x";
+ }
+ if (streq(tty, "ttyS1"))
+ return "TERM=vt220";
+#endif
+ return "TERM=vt102";
+ return "TERM=vt220";
}
bool dirent_is_file(const struct dirent *de) {
--- systemd-210/src/shared/util.h
+++ systemd-210/src/shared/util.h 2014-04-30 10:24:51.134235665 +0000
@@ -418,6 +418,7 @@ unsigned lines(void);
Index: systemd/src/shared/util.h
===================================================================
--- systemd.orig/src/shared/util.h
+++ systemd/src/shared/util.h
@@ -475,6 +475,7 @@ unsigned lines(void);
void columns_lines_cache_reset(int _unused_ signum);
bool on_tty(void);

View File

@ -1,26 +0,0 @@
From aa44499da15a8fa7026463555a7a27e55e4e24a8 Mon Sep 17 00:00:00 2001
From: Philippe De Swert <philippedeswert@gmail.com>
Date: Wed, 10 Sep 2014 22:14:41 +0300
Subject: [PATCH] activate: fix fd leak in do_accept()
Found with Coverity.
---
src/activate/activate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/activate/activate.c src/activate/activate.c
index 8942773..0a1df37 100644
--- src/activate/activate.c
+++ src/activate/activate.c
@@ -242,7 +242,7 @@ static int launch1(const char* child, char** argv, char **env, int fd) {
static int do_accept(const char* name, char **argv, char **envp, int fd) {
_cleanup_free_ char *local = NULL, *peer = NULL;
- int fd2;
+ _cleanup_close_ int fd2 = -1;
fd2 = accept(fd, NULL, NULL);
if (fd2 < 0) {
--
1.7.9.2

View File

@ -1,11 +1,13 @@
---
systemd-209/src/core/shutdown.c | 4 ++++
systemd-209/src/systemctl/systemctl.c | 22 +++++++++++++++-------
2 files changed, 19 insertions(+), 7 deletions(-)
src/core/shutdown.c | 4 ++++
src/systemctl/systemctl.c | 18 ++++++++++++------
2 files changed, 16 insertions(+), 6 deletions(-)
--- systemd-209/src/core/shutdown.c
+++ systemd-209/src/core/shutdown.c 2014-02-28 11:17:22.000000000 +0000
@@ -449,6 +449,10 @@ int main(int argc, char *argv[]) {
Index: systemd-218/src/core/shutdown.c
===================================================================
--- systemd-218.orig/src/core/shutdown.c
+++ systemd-218/src/core/shutdown.c
@@ -400,6 +400,10 @@ int main(int argc, char *argv[]) {
}
reboot(cmd);
@ -16,9 +18,11 @@
if (errno == EPERM && in_container) {
/* If we are in a container, and we lacked
* CAP_SYS_BOOT just exit, this will kill our
--- systemd-209/src/systemctl/systemctl.c
+++ systemd-209/src/systemctl/systemctl.c 2014-02-28 11:19:35.000000000 +0000
@@ -93,6 +93,7 @@ static bool arg_no_pager = false;
Index: systemd-218/src/systemctl/systemctl.c
===================================================================
--- systemd-218.orig/src/systemctl/systemctl.c
+++ systemd-218/src/systemctl/systemctl.c
@@ -94,6 +94,7 @@ static bool arg_no_pager = false;
static bool arg_no_wtmp = false;
static bool arg_no_wall = false;
static bool arg_no_reload = false;
@ -26,7 +30,7 @@
static bool arg_show_types = false;
static bool arg_ignore_inhibitors = false;
static bool arg_dry = false;
@@ -5578,6 +5579,7 @@ static int halt_parse_argv(int argc, cha
@@ -6813,6 +6814,7 @@ static int halt_parse_argv(int argc, cha
{ "reboot", no_argument, NULL, ARG_REBOOT },
{ "force", no_argument, NULL, 'f' },
{ "wtmp-only", no_argument, NULL, 'w' },
@ -34,7 +38,7 @@
{ "no-wtmp", no_argument, NULL, 'd' },
{ "no-wall", no_argument, NULL, ARG_NO_WALL },
{}
@@ -5629,10 +5631,13 @@ static int halt_parse_argv(int argc, cha
@@ -6865,10 +6867,13 @@ static int halt_parse_argv(int argc, cha
case 'i':
case 'h':
@ -49,17 +53,17 @@
case '?':
return -EINVAL;
@@ -6274,20 +6279,23 @@ done:
static int halt_now(enum action a) {
-/* Make sure C-A-D is handled by the kernel from this
@@ -7511,7 +7516,8 @@ static int halt_now(enum action a) {
/* The kernel will automaticall flush ATA disks and suchlike
* on reboot(), but the file systems need to be synce'd
* explicitly in advance. */
- sync();
+ if (!arg_no_sync)
+ sync();
+
+ /* Make sure C-A-D is handled by the kernel from this
* point on... */
reboot(RB_ENABLE_CAD);
/* Make sure C-A-D is handled by the kernel from this point
* on... */
@@ -7519,14 +7525,14 @@ static int halt_now(enum action a) {
switch (a) {
@ -67,12 +71,11 @@
- log_info("Halting.");
- reboot(RB_HALT_SYSTEM);
- return -errno;
-
case ACTION_POWEROFF:
log_info("Powering off.");
reboot(RB_POWER_OFF);
+ /* Fall through */
+
+ /* fall-through */
+ case ACTION_HALT:
+ log_info("Halting.");
+ reboot(RB_HALT_SYSTEM);

View File

@ -11,19 +11,23 @@ NFS share is added as "After=" dependency to the <nfs-share-mount-point>.mount.
src/shared/util.c | 1
5 files changed, 234 insertions(+), 2 deletions(-)
--- systemd-210/Makefile.am
+++ systemd-210/Makefile.am 2014-02-26 12:44:20.000000000 +0000
@@ -994,6 +994,8 @@ libsystemd_core_la_SOURCES = \
Index: systemd-218/Makefile.am
===================================================================
--- systemd-218.orig/Makefile.am
+++ systemd-218/Makefile.am
@@ -1134,6 +1134,8 @@ libsystemd_core_la_SOURCES = \
src/core/machine-id-setup.h \
src/core/mount-setup.c \
src/core/mount-setup.h \
+ src/core/mount-iface.c \
+ src/core/mount-iface.h \
src/core/kmod-setup.c \
src/core/kmod-setup.h \
src/core/loopback-setup.h \
src/core/loopback-setup.c \
src/core/condition.c \
--- systemd-210/src/core/mount-iface.c
+++ systemd-210/src/core/mount-iface.c 2014-02-26 10:18:36.000000000 +0000
Index: systemd-218/src/core/mount-iface.c
===================================================================
--- /dev/null
+++ systemd-218/src/core/mount-iface.c
@@ -0,0 +1,173 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
@ -198,8 +202,10 @@ NFS share is added as "After=" dependency to the <nfs-share-mount-point>.mount.
+ freeifaddrs(ifa_list);
+ ifa_list = NULL;
+}
--- systemd-210/src/core/mount-iface.h
+++ systemd-210/src/core/mount-iface.h 2014-02-26 10:08:20.000000000 +0000
Index: systemd-218/src/core/mount-iface.h
===================================================================
--- /dev/null
+++ systemd-218/src/core/mount-iface.h
@@ -0,0 +1,25 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
@ -226,9 +232,11 @@ NFS share is added as "After=" dependency to the <nfs-share-mount-point>.mount.
+
+char *host2iface(const char *ip);
+void freeroutes(void);
--- systemd-210/src/core/mount.c
+++ systemd-210/src/core/mount.c 2014-03-03 12:13:23.406246117 +0000
@@ -36,6 +36,7 @@
Index: systemd-218/src/core/mount.c
===================================================================
--- systemd-218.orig/src/core/mount.c
+++ systemd-218/src/core/mount.c
@@ -38,6 +38,7 @@
#include "mkdir.h"
#include "path-util.h"
#include "mount-setup.h"
@ -236,7 +244,7 @@ NFS share is added as "After=" dependency to the <nfs-share-mount-point>.mount.
#include "unit-name.h"
#include "dbus-mount.h"
#include "special.h"
@@ -1388,8 +1389,9 @@ static int mount_add_one(
@@ -1365,8 +1366,9 @@ static int mount_add_one(
_cleanup_free_ char *e = NULL, *w = NULL, *o = NULL, *f = NULL;
bool load_extras = false;
MountParameters *p;
@ -247,7 +255,7 @@ NFS share is added as "After=" dependency to the <nfs-share-mount-point>.mount.
int r;
assert(m);
@@ -1414,6 +1416,8 @@ static int mount_add_one(
@@ -1391,6 +1393,8 @@ static int mount_add_one(
if (!e)
return -ENOMEM;
@ -256,16 +264,16 @@ NFS share is added as "After=" dependency to the <nfs-share-mount-point>.mount.
u = manager_get_unit(m, e);
if (!u) {
delete = true;
@@ -1442,7 +1446,7 @@ static int mount_add_one(
@@ -1419,7 +1423,7 @@ static int mount_add_one(
if (m->running_as == SYSTEMD_SYSTEM) {
const char* target;
- target = fstype_is_network(fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
- target = mount_needs_network(options, fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
+ target = isnetwork ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true);
if (r < 0)
@@ -1519,6 +1523,32 @@ static int mount_add_one(
goto fail;
@@ -1505,6 +1509,32 @@ static int mount_add_one(
goto fail;
}
@ -288,7 +296,7 @@ NFS share is added as "After=" dependency to the <nfs-share-mount-point>.mount.
+ else {
+ r = unit_add_dependency_by_name(u, UNIT_AFTER, target, NULL, true);
+ if (r < 0)
+ log_error_unit(u->id, "Failed to add dependency on %s, ignoring: %s",
+ log_unit_error(u->id, "Failed to add dependency on %s, ignoring: %s",
+ target, strerror(-r));
+ }
+ }
@ -298,21 +306,23 @@ NFS share is added as "After=" dependency to the <nfs-share-mount-point>.mount.
if (changed)
unit_add_to_dbus_queue(u);
@@ -1583,6 +1613,7 @@ static int mount_load_proc_self_mountinf
if (k < 0)
@@ -1560,6 +1590,7 @@ static int mount_load_proc_self_mountinf
if (r == 0 && k < 0)
r = k;
}
+ freeroutes(); /* Just in case of using the routing table with host2iface() */
return r;
}
--- systemd-210/src/shared/util.c
+++ systemd-210/src/shared/util.c 2014-02-24 15:17:42.000000000 +0000
@@ -1502,6 +1502,7 @@ bool fstype_is_network(const char *fstyp
Index: systemd-218/src/shared/util.c
===================================================================
--- systemd-218.orig/src/shared/util.c
+++ systemd-218/src/shared/util.c
@@ -1667,6 +1667,7 @@ bool fstype_is_network(const char *fstyp
"ncp\0"
"nfs\0"
"nfs4\0"
+ "afs\0"
"gfs\0"
"gfs2\0";
"gfs2\0"
"glusterfs\0";

View File

@ -1,56 +0,0 @@
From 46eea341c36f0caf0bdd5b2274a1ef7cb4e83e97 Mon Sep 17 00:00:00 2001
From: Henrik Grindal Bakken <hgb@ifi.uio.no>
Date: Thu, 27 Feb 2014 21:19:13 +0100
Subject: [PATCH] architecture: Add tilegx
Add Tilera's TILE-GX processor family support.
---
src/shared/architecture.c | 3 +++
src/shared/architecture.h | 3 +++
2 files changed, 6 insertions(+)
diff --git src/shared/architecture.c src/shared/architecture.c
index ceba492..fcdb3d5 100644
--- src/shared/architecture.c
+++ src/shared/architecture.c
@@ -112,6 +112,8 @@ Architecture uname_architecture(void) {
{ "sh", ARCHITECTURE_SH },
#elif defined(__m68k__)
{ "m68k", ARCHITECTURE_M68K },
+#elif defined(__tilegx__)
+ { "tilegx", ARCHITECTURE_TILEGX },
#else
#error "Please register your architecture here!"
#endif
@@ -158,6 +160,7 @@ static const char *const architecture_table[_ARCHITECTURE_MAX] = {
[ARCHITECTURE_SH] = "sh",
[ARCHITECTURE_SH64] = "sh64",
[ARCHITECTURE_M68K] = "m68k",
+ [ARCHITECTURE_TILEGX] = "tilegx",
};
DEFINE_STRING_TABLE_LOOKUP(architecture, Architecture);
diff --git src/shared/architecture.h src/shared/architecture.h
index 3183645..e589a91 100644
--- src/shared/architecture.h
+++ src/shared/architecture.h
@@ -47,6 +47,7 @@ typedef enum Architecture {
ARCHITECTURE_SH,
ARCHITECTURE_SH64,
ARCHITECTURE_M68K,
+ ARCHITECTURE_TILEGX,
_ARCHITECTURE_MAX,
_ARCHITECTURE_INVALID = -1
} Architecture;
@@ -107,6 +108,8 @@ Architecture uname_architecture(void);
# define native_architecture() ARCHITECTURE_SH
#elif defined(__m68k__)
# define native_architecture() ARCHITECTURE_M68K
+#elif defined(__tilegx__)
+# define native_architecture() ARCHITECTURE_TILEGX
#else
#error "Please register your architecture here!"
#endif
--
1.7.9.2

View File

@ -1,79 +0,0 @@
From 7b909d7407965c03caaba30daae7aee113627a83 Mon Sep 17 00:00:00 2001
From: Josh Triplett <josh@joshtriplett.org>
Date: Tue, 11 Mar 2014 21:16:33 -0700
Subject: [PATCH] backlight: Avoid restoring brightness to an unreadably dim
level
Some systems turn the backlight all the way off at the lowest levels.
Clamp saved brightness to at least 1 or 5% of max_brightness. This
avoids preserving an unreadably dim screen, which would otherwise force
the user to disable state restoration.
---
src/backlight/backlight.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git src/backlight/backlight.c src/backlight/backlight.c
index 81470b3..abf8bcf 100644
--- src/backlight/backlight.c
+++ src/backlight/backlight.c
@@ -192,6 +192,48 @@ static bool validate_device(struct udev *udev, struct udev_device *device) {
return true;
}
+/* Some systems turn the backlight all the way off at the lowest levels.
+ * clamp_brightness clamps the saved brightness to at least 1 or 5% of
+ * max_brightness. This avoids preserving an unreadably dim screen, which
+ * would otherwise force the user to disable state restoration. */
+static void clamp_brightness(struct udev_device *device, char **value) {
+ int r;
+ const char *max_brightness_str;
+ unsigned brightness, max_brightness, new_brightness;
+
+ max_brightness_str = udev_device_get_sysattr_value(device, "max_brightness");
+ if (!max_brightness_str) {
+ log_warning("Failed to read max_brightness attribute; not checking saved brightness");
+ return;
+ }
+
+ r = safe_atou(*value, &brightness);
+ if (r < 0) {
+ log_warning("Failed to parse brightness \"%s\": %s", *value, strerror(-r));
+ return;
+ }
+
+ r = safe_atou(max_brightness_str, &max_brightness);
+ if (r < 0) {
+ log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r));
+ return;
+ }
+
+ new_brightness = MAX3(brightness, 1U, max_brightness/20);
+ if (new_brightness != brightness) {
+ char *old_value = *value;
+
+ r = asprintf(value, "%u", new_brightness);
+ if (r < 0) {
+ log_oom();
+ return;
+ }
+
+ log_debug("Saved brightness %s too low; increasing to %s.", old_value, *value);
+ free(old_value);
+ }
+}
+
int main(int argc, char *argv[]) {
_cleanup_udev_unref_ struct udev *udev = NULL;
_cleanup_udev_device_unref_ struct udev_device *device = NULL;
@@ -306,6 +348,8 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
+ clamp_brightness(device, &value);
+
r = udev_device_set_sysattr_value(device, "brightness", value);
if (r < 0) {
log_error("Failed to write system attribute: %s", strerror(-r));
--
1.7.9.2

View File

@ -1,25 +0,0 @@
From a163b64c4b08e8a4ad39a9a295acf3d1634024a3 Mon Sep 17 00:00:00 2001
From: Dan Kilman <dankilman@gmail.com>
Date: Sun, 13 Apr 2014 18:06:13 +0300
Subject: [PATCH] bash completion: fix __get_startable_units
---
shell-completion/bash/systemctl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git shell-completion/bash/systemctl shell-completion/bash/systemctl
index 992e52d..e1c8420 100644
--- shell-completion/bash/systemctl
+++ shell-completion/bash/systemctl
@@ -56,7 +56,7 @@ __get_all_units () { __systemctl $1 list-units --all \
__get_active_units () { __systemctl $1 list-units \
| { while read -r a b; do echo " $a"; done; }; }
__get_startable_units () { __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap \
- | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed " ]] && echo " $a"; done; }; }
+ | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }; }
__get_failed_units () { __systemctl $1 list-units \
| { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; }
__get_enabled_units () { __systemctl $1 list-unit-files \
--
1.7.9.2

View File

@ -1,46 +0,0 @@
From be8f4a9fa732d61e845e1ab1a62ac3a6b368d3a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 19 Jul 2014 19:46:04 -0400
Subject: [PATCH] bash-completion: -p option for journalctl
---
shell-completion/bash/journalctl | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git shell-completion/bash/journalctl shell-completion/bash/journalctl
index e4b2f4a..14dcd22 100644
--- shell-completion/bash/journalctl
+++ shell-completion/bash/journalctl
@@ -35,6 +35,8 @@ __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
_UDEV_{SYSNAME,DEVNODE,DEVLINK}
__CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
+__syslog_priorities=(emerg alert crit err warning notice info debug)
+
_journalctl() {
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=(
@@ -44,8 +46,8 @@ _journalctl() {
--no-tail -q --quiet --setup-keys --this-boot --verify
--version --list-catalog --update-catalog --list-boots'
[ARG]='-b --boot --this-boot -D --directory --file -F --field
- -o --output -u --unit --user-unit'
- [ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until
+ -o --output -u --unit --user-unit -p --priority'
+ [ARGUNKNOWN]='-c --cursor --interval -n --lines --since --until
--verify-key'
)
@@ -68,6 +70,9 @@ _journalctl() {
--field|-F)
comps=${__journal_fields[*]}
;;
+ --priority|-p)
+ comps=${__syslog_priorities[*]}
+ ;;
--unit|-u)
comps=$(journalctl -F '_SYSTEMD_UNIT' 2>/dev/null)
;;
--
1.7.9.2

View File

@ -3,11 +3,11 @@
src/login/logind-dbus.c | 20 ++++++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
Index: systemd-210/src/login/logind-action.c
Index: systemd-218/src/login/logind-action.c
===================================================================
--- systemd-210.orig/src/login/logind-action.c
+++ systemd-210/src/login/logind-action.c
@@ -101,6 +101,11 @@ int manager_handle_action(
--- systemd-218.orig/src/login/logind-action.c
+++ systemd-218/src/login/logind-action.c
@@ -83,6 +83,11 @@ int manager_handle_action(
/* If the key handling is inhibited, don't do anything */
if (inhibit_key > 0) {
@ -19,11 +19,11 @@ Index: systemd-210/src/login/logind-action.c
if (manager_is_inhibited(m, inhibit_key, INHIBIT_BLOCK, NULL, true, false, 0, NULL)) {
log_debug("Refusing operation, %s is inhibited.", inhibit_what_to_string(inhibit_key));
return 0;
Index: systemd-210/src/login/logind-dbus.c
Index: systemd-218/src/login/logind-dbus.c
===================================================================
--- systemd-210.orig/src/login/logind-dbus.c
+++ systemd-210/src/login/logind-dbus.c
@@ -1469,9 +1469,11 @@ static int method_do_shutdown_or_sleep(
--- systemd-218.orig/src/login/logind-dbus.c
+++ systemd-218/src/login/logind-dbus.c
@@ -1487,9 +1487,11 @@ static int method_do_shutdown_or_sleep(
sd_bus_error *error) {
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
@ -36,7 +36,7 @@ Index: systemd-210/src/login/logind-dbus.c
assert(m);
assert(message);
@@ -1515,7 +1517,17 @@ static int method_do_shutdown_or_sleep(
@@ -1533,7 +1535,17 @@ static int method_do_shutdown_or_sleep(
multiple_sessions = r > 0;
blocked = manager_is_inhibited(m, w, INHIBIT_BLOCK, NULL, false, true, uid, NULL);
@ -52,24 +52,24 @@ Index: systemd-210/src/login/logind-dbus.c
+
+
+ if (multiple_sessions && !shutdown_through_acpi) {
r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message,
action_multiple_sessions, interactive, error, method, m);
r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action_multiple_sessions, interactive, &m->polkit_registry, error);
if (r < 0)
@@ -1524,7 +1536,7 @@ static int method_do_shutdown_or_sleep(
return r;
@@ -1541,7 +1553,7 @@ static int method_do_shutdown_or_sleep(
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
}
- if (blocked) {
+ if (blocked && !shutdown_through_acpi) {
r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message,
action_ignore_inhibit, interactive, error, method, m);
r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action_ignore_inhibit, interactive, &m->polkit_registry, error);
if (r < 0)
@@ -1533,7 +1545,7 @@ static int method_do_shutdown_or_sleep(
return r;
@@ -1549,7 +1561,7 @@ static int method_do_shutdown_or_sleep(
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
}
- if (!multiple_sessions && !blocked) {
+ if (!multiple_sessions && !blocked && !shutdown_through_acpi) {
r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message,
action, interactive, error, method, m);
r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action, interactive, &m->polkit_registry, error);
if (r < 0)
return r;

View File

@ -1,215 +0,0 @@
Based on d2edfae0f9bdbecf6a8518e2a5bcf06f470e0d9e Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Wed, 28 May 2014 17:36:40 +0800
Subject: [PATCH] build-sys: use glibc's xattr support instead of requiring
libattr
---
configure.ac | 53 ++-----------------------------------------
src/core/mount-setup.c | 2 -
src/core/socket.c | 4 ---
src/journal/journal-file.c | 7 -----
src/journal/journal-vacuum.c | 10 --------
src/shared/label.c | 2 -
src/shared/smack-util.c | 4 ---
7 files changed, 7 insertions(+), 75 deletions(-)
--- configure.ac
+++ configure.ac 2014-06-03 00:00:00.000000000 +0000
@@ -526,44 +526,6 @@ AC_SUBST(ACL_LIBS)
AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno])
# ------------------------------------------------------------------------------
-AC_ARG_ENABLE([xattr],
- AS_HELP_STRING([--disable-xattr],[Disable optional XATTR support]),
- [case "${enableval}" in
- yes) have_xattr=yes ;;
- no) have_xattr=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --disable-xattr) ;;
- esac],
- [have_xattr=auto])
-
-if test "x${have_xattr}" != xno ; then
- AC_CHECK_HEADERS(
- [attr/xattr.h],
- [have_xattr=yes],
- [if test "x$have_xattr" = xyes ; then
- AC_MSG_ERROR([*** XATTR headers not found.])
- fi])
-
- AC_CHECK_LIB(
- [attr],
- [fsetxattr],
- [have_xattr=yes],
- [if test "x$have_xattr" = xyes ; then
- AC_MSG_ERROR([*** libattr not found.])
- fi])
-
- if test "x$have_xattr" = xyes ; then
- XATTR_LIBS="-lattr"
- AC_DEFINE(HAVE_XATTR, 1, [XATTR available])
- else
- have_xattr=no
- fi
-else
- XATTR_LIBS=
-fi
-AC_SUBST(XATTR_LIBS)
-AM_CONDITIONAL([HAVE_XATTR], [test "x$have_xattr" != xno])
-
-# ------------------------------------------------------------------------------
AC_ARG_ENABLE([smack], AS_HELP_STRING([--disable-smack],[Disable optional SMACK support]),
[case "${enableval}" in
yes) have_smack=yes ;;
@@ -572,17 +534,9 @@ AC_ARG_ENABLE([smack], AS_HELP_STRING([-
esac],
[have_smack=auto])
-if test "x${have_xattr}" = xno; then
- if test "x${have_smack}" = xyes; then
- AC_MSG_ERROR(SMACK requires xattr support)
- else
- have_smack=no
- fi
-else
- if test "x${have_smack}" = xauto; then
- M4_DEFINES="$M4_DEFINES -DHAVE_SMACK"
- have_smack=yes
- fi
+if test "x${have_smack}" = xauto; then
+ M4_DEFINES="$M4_DEFINES -DHAVE_SMACK"
+ have_smack=yes
fi
AC_ARG_WITH(smack-run-label,
@@ -1131,7 +1085,6 @@ AC_MSG_RESULT([
SMACK: ${have_smack}
XZ: ${have_xz}
ACL: ${have_acl}
- XATTR: ${have_xattr}
GCRYPT: ${have_gcrypt}
QRENCODE: ${have_qrencode}
MICROHTTPD: ${have_microhttpd}
--- src/core/mount-setup.c
+++ src/core/mount-setup.c 2014-06-03 00:00:00.000000000 +0000
@@ -93,10 +93,8 @@ static const MountPoint mount_table[] =
NULL, MNT_FATAL|MNT_IN_CONTAINER },
{ "tmpfs", "/sys/fs/cgroup", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME,
NULL, MNT_IN_CONTAINER },
-#ifdef HAVE_XATTR
{ "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd,xattr", MS_NOSUID|MS_NOEXEC|MS_NODEV,
NULL, MNT_IN_CONTAINER },
-#endif
{ "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV,
NULL, MNT_IN_CONTAINER },
{ "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
--- src/core/socket.c
+++ src/core/socket.c 2014-06-03 00:00:00.000000000 +0000
@@ -29,9 +29,7 @@
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <mqueue.h>
-#ifdef HAVE_XATTR
-#include <attr/xattr.h>
-#endif
+#include <sys/xattr.h>
#include "sd-event.h"
#include "log.h"
--- src/journal/journal-file.c
+++ src/journal/journal-file.c 2014-06-03 00:00:00.000000000 +0000
@@ -26,10 +26,7 @@
#include <sys/statvfs.h>
#include <fcntl.h>
#include <stddef.h>
-
-#ifdef HAVE_XATTR
-#include <attr/xattr.h>
-#endif
+#include <sys/xattr.h>
#include "journal-def.h"
#include "journal-file.h"
@@ -2515,7 +2512,6 @@ int journal_file_open(
}
if (f->last_stat.st_size == 0 && f->writable) {
-#ifdef HAVE_XATTR
uint64_t crtime;
/* Let's attach the creation time to the journal file,
@@ -2530,7 +2526,6 @@ int journal_file_open(
crtime = htole64((uint64_t) now(CLOCK_REALTIME));
fsetxattr(f->fd, "user.crtime_usec", &crtime, sizeof(crtime), XATTR_CREATE);
-#endif
#ifdef HAVE_GCRYPT
/* Try to load the FSPRG state, and if we can't, then
--- src/journal/journal-vacuum.c
+++ src/journal/journal-vacuum.c 2014-06-03 00:00:00.000000000 +0000
@@ -24,10 +24,7 @@
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <unistd.h>
-
-#ifdef HAVE_XATTR
-#include <attr/xattr.h>
-#endif
+#include <sys/xattr.h>
#include "journal-def.h"
#include "journal-file.h"
@@ -79,11 +76,8 @@ static void patch_realtime(
unsigned long long *realtime) {
usec_t x;
-
-#ifdef HAVE_XATTR
uint64_t crtime;
_cleanup_free_ const char *path = NULL;
-#endif
/* The timestamp was determined by the file name, but let's
* see if the file might actually be older than the file name
@@ -106,7 +100,6 @@ static void patch_realtime(
if (x > 0 && x != (usec_t) -1 && x < *realtime)
*realtime = x;
-#ifdef HAVE_XATTR
/* Let's read the original creation time, if possible. Ideally
* we'd just query the creation time the FS might provide, but
* unfortunately there's currently no sane API to query
@@ -125,7 +118,6 @@ static void patch_realtime(
if (crtime > 0 && crtime != (uint64_t) -1 && crtime < *realtime)
*realtime = crtime;
}
-#endif
}
static int journal_file_empty(int dir_fd, const char *name) {
--- src/shared/label.c
+++ src/shared/label.c 2014-06-03 00:00:00.000000000 +0000
@@ -27,9 +27,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#ifdef HAVE_XATTR
#include <sys/xattr.h>
-#endif
#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
--- src/shared/smack-util.c
+++ src/shared/smack-util.c 2014-06-03 00:00:00.000000000 +0000
@@ -23,9 +23,7 @@
#include <unistd.h>
#include <string.h>
-#ifdef HAVE_XATTR
-#include <attr/xattr.h>
-#endif
+#include <sys/xattr.h>
#include "smack-util.h"

View File

@ -1,21 +0,0 @@
Based on e05aa2e02ba35d8b3741dddb79af3c802308414b Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Fri, 25 Jul 2014 10:25:06 +0200
Subject: [PATCH] bus-proxyd: fix incorrect comparison
We should be interested in k variable.
---
src/bus-proxyd/bus-proxyd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- src/bus-proxyd/bus-proxyd.c
+++ src/bus-proxyd/bus-proxyd.c 2014-07-28 09:37:29.274735818 +0000
@@ -698,7 +698,7 @@ int main(int argc, char *argv[]) {
k = sd_bus_send(a, m, NULL);
if (k < 0) {
- if (r == -ECONNRESET)
+ if (k == -ECONNRESET)
r = 0;
else {
r = k;

View File

@ -1,80 +0,0 @@
From a641dcd9bf05418d6a6c165e1c0cff615b4a0f47 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 18 Mar 2014 04:06:36 +0100
Subject: [PATCH] cgroup: it's not OK to invoke alloca() in loops
---
src/core/mount-setup.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git src/core/mount-setup.c src/core/mount-setup.c
index 387030a..c6d3f4b 100644
--- src/core/mount-setup.c
+++ src/core/mount-setup.c
@@ -216,10 +216,10 @@ int mount_setup_early(void) {
}
int mount_cgroup_controllers(char ***join_controllers) {
- int r;
- char buf[LINE_MAX];
_cleanup_set_free_free_ Set *controllers = NULL;
_cleanup_fclose_ FILE *f;
+ char buf[LINE_MAX];
+ int r;
/* Mount all available cgroup controllers that are built into the kernel. */
@@ -262,6 +262,7 @@ int mount_cgroup_controllers(char ***join_controllers) {
}
for (;;) {
+ _cleanup_free_ char *options = NULL, *controller = NULL, *where = NULL;
MountPoint p = {
.what = "cgroup",
.type = "cgroup",
@@ -269,7 +270,6 @@ int mount_cgroup_controllers(char ***join_controllers) {
.mode = MNT_IN_CONTAINER,
};
char ***k = NULL;
- _cleanup_free_ char *options = NULL, *controller;
controller = set_steal_first(controllers);
if (!controller)
@@ -286,7 +286,7 @@ int mount_cgroup_controllers(char ***join_controllers) {
for (i = *k, j = *k; *i; i++) {
if (!streq(*i, controller)) {
- char _cleanup_free_ *t;
+ _cleanup_free_ char *t;
t = set_remove(controllers, *i);
if (!t) {
@@ -308,7 +308,11 @@ int mount_cgroup_controllers(char ***join_controllers) {
controller = NULL;
}
- p.where = strappenda("/sys/fs/cgroup/", options);
+ where = strappend("/sys/fs/cgroup/", options);
+ if (!where)
+ return log_oom();
+
+ p.where = where;
p.options = options;
r = mount_one(&p, true);
@@ -319,7 +323,11 @@ int mount_cgroup_controllers(char ***join_controllers) {
char **i;
for (i = *k; *i; i++) {
- char *t = strappenda("/sys/fs/cgroup/", *i);
+ _cleanup_free_ char *t = NULL;
+
+ t = strappend("/sys/fs/cgroup/", *i);
+ if (!t)
+ return log_oom();
r = symlink(options, t);
if (r < 0 && errno != EEXIST) {
--
1.7.9.2

View File

@ -1,30 +0,0 @@
Based on ec15977a3cd82eff6c94bb13db72195f7cd512e8 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Fri, 29 Aug 2014 20:35:15 -0400
Subject: [PATCH] completion: filter templates from restartable units
Since c6a373a2634854, we might encounter unit templates via the
'list-units' verb. These aren't restartable (and we throw errors), so
make sure they're filtered out of the completion options.
fixes downstream bug: https://bugs.archlinux.org/task/41719
---
shell-completion/bash/systemctl.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git shell-completion/bash/systemctl.in shell-completion/bash/systemctl.in
index 64b15df..0150018 100644
--- shell-completion/bash/systemctl
+++ shell-completion/bash/systemctl
@@ -182,7 +182,7 @@ _systemctl () {
comps=$( __filter_units_by_property $mode CanStart yes \
$( __get_all_units $mode \
| while read -r line; do \
- [[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || echo " $line"; \
+ [[ "$line" =~ @\.|\.(device|snapshot|socket|timer)$ ]] || echo " $line"; \
done ))
compopt -o filenames
--
1.7.9.2

View File

@ -1,73 +0,0 @@
From 342aea195051633c69ba7b8c02c82a0e5f8cbde4 Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
Date: Fri, 16 May 2014 16:58:31 -0700
Subject: [PATCH] conf-parser: silently ignore sections starting with "X-"
This allows external tools to keep additional unit information in a
separate section without scaring users with a big warning.
---
src/shared/conf-parser.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git src/shared/conf-parser.c src/shared/conf-parser.c
index d27b1b7..062b15b 100644
--- src/shared/conf-parser.c
+++ src/shared/conf-parser.c
@@ -204,6 +204,7 @@ static int parse_line(const char* unit,
bool allow_include,
char **section,
unsigned *section_line,
+ bool *section_ignored,
char *l,
void *userdata) {
@@ -266,7 +267,7 @@ static int parse_line(const char* unit,
if (sections && !nulstr_contains(sections, n)) {
- if (!relaxed)
+ if (!relaxed && !startswith(n, "X-"))
log_syntax(unit, LOG_WARNING, filename, line, EINVAL,
"Unknown section '%s'. Ignoring.", n);
@@ -274,10 +275,12 @@ static int parse_line(const char* unit,
free(*section);
*section = NULL;
*section_line = 0;
+ *section_ignored = true;
} else {
free(*section);
*section = n;
*section_line = line;
+ *section_ignored = false;
}
return 0;
@@ -285,7 +288,7 @@ static int parse_line(const char* unit,
if (sections && !*section) {
- if (!relaxed)
+ if (!relaxed && !*section_ignored)
log_syntax(unit, LOG_WARNING, filename, line, EINVAL,
"Assignment outside of section. Ignoring.");
@@ -328,6 +331,7 @@ int config_parse(const char *unit,
_cleanup_free_ char *section = NULL, *continuation = NULL;
_cleanup_fclose_ FILE *ours = NULL;
unsigned line = 0, section_line = 0;
+ bool section_ignored = false;
int r;
assert(filename);
@@ -399,6 +403,7 @@ int config_parse(const char *unit,
allow_include,
&section,
&section_line,
+ &section_ignored,
p,
userdata);
free(c);
--
1.7.9.2

View File

@ -1,29 +0,0 @@
From 36d239dbdaf94ba2d96bb60ac45ecfc58624b1eb Mon Sep 17 00:00:00 2001
From: Daniel Mack <zonque@gmail.com>
Date: Fri, 7 Mar 2014 11:41:18 +0100
Subject: [PATCH] core/busname: add lookup string for
BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT
When a busname unit enters BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT, the
serialization will not be able to look up the result as string via
busname_result_to_string(). This leads to an assertion trap during
daemon-reexec.
---
src/core/busname.c | 1 +
1 file changed, 1 insertion(+)
diff --git src/core/busname.c src/core/busname.c
index 4c34538..237011a 100644
--- src/core/busname.c
+++ src/core/busname.c
@@ -548,6 +548,7 @@ DEFINE_STRING_TABLE_LOOKUP(busname_state, BusNameState);
static const char* const busname_result_table[_BUSNAME_RESULT_MAX] = {
[BUSNAME_SUCCESS] = "success",
[BUSNAME_FAILURE_RESOURCES] = "resources",
+ [BUSNAME_FAILURE_SERVICE_FAILED_PERMANENT] = "failed-permanent",
};
DEFINE_STRING_TABLE_LOOKUP(busname_result, BusNameResult);
--
1.7.9.2

View File

@ -1,89 +0,0 @@
Based on 574634bcacb01efe15ca2742effd461a5b7afb5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 13 May 2014 23:22:13 +0200
Subject: [PATCH] core: close socket fds asynchronously
http://lists.freedesktop.org/archives/systemd-devel/2014-April/018928.html
---
src/core/async.c | 24 ++++++++++++++++++++++++
src/core/service.c | 5 +++--
2 files changed, 27 insertions(+), 2 deletions(-)
Index: src/core/service.c
===================================================================
--- src/core/service.c.orig
+++ src/core/service.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <sys/reboot.h>
+#include "async.h"
#include "manager.h"
#include "unit.h"
#include "service.h"
@@ -240,7 +241,7 @@ static void service_close_socket_fd(Serv
if (s->socket_fd < 0)
return;
- close_nointr_nofail(s->socket_fd);
+ asynchronous_close(s->socket_fd);
s->socket_fd = -1;
}
@@ -2767,7 +2768,7 @@ static int service_deserialize_item(Unit
else {
if (s->socket_fd >= 0)
- close_nointr_nofail(s->socket_fd);
+ asynchronous_close(s->socket_fd);
s->socket_fd = fdset_remove(fds, fd);
}
} else if (streq(key, "main-exec-status-pid")) {
Index: src/core/async.c
===================================================================
--- src/core/async.c.orig
+++ src/core/async.c
@@ -24,6 +24,7 @@
#include "async.h"
#include "log.h"
+#include "util.h"
int asynchronous_job(void* (*func)(void *p), void *arg) {
pthread_attr_t a;
@@ -70,3 +71,26 @@ int asynchronous_sync(void) {
return asynchronous_job(sync_thread, NULL);
}
+
+static void *close_thread(void *p) {
+ int fd = PTR_TO_INT(p);
+ if (fd >= 0)
+ close_nointr_nofail(fd);
+ return NULL;
+}
+
+int asynchronous_close(int fd) {
+ int r;
+
+ /* This is supposed to behave similar to safe_close(), but
+ * actually invoke close() asynchronously, so that it will
+ * never block. Ideally the kernel would have an API for this,
+ * but it doesn't, so we work around it, and hide this as a
+ * far away as we can. */
+
+ r = asynchronous_job(close_thread, INT_TO_PTR(fd));
+ if (r < 0 && fd >= 0)
+ close_nointr_nofail(fd);
+
+ return -1;
+}
Index: src/core/async.h
===================================================================
--- src/core/async.h.orig
+++ src/core/async.h
@@ -23,3 +23,4 @@
int asynchronous_job(void* (*func)(void *p), void *arg);
int asynchronous_sync(void);
+int asynchronous_close(int fd);

View File

@ -1,36 +0,0 @@
From f7101b7368dfe41dbc8b7203e06133cccb589c01 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Tue, 7 Oct 2014 13:35:41 +0200
Subject: [PATCH] core: don't allow enabling if unit is masked
---
src/shared/install.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git src/shared/install.c src/shared/install.c
index fa064c2..945bb27 100644
--- src/shared/install.c
+++ src/shared/install.c
@@ -1516,6 +1516,19 @@ int unit_file_enable(
return r;
STRV_FOREACH(i, files) {
+ UnitFileState state;
+
+ state = unit_file_get_state(scope, root_dir, *i);
+ if (state < 0) {
+ log_error("Failed to get unit file state for %s: %s", *i, strerror(-state));
+ return state;
+ }
+
+ if (state == UNIT_FILE_MASKED || state == UNIT_FILE_MASKED_RUNTIME) {
+ log_error("Failed to enable unit: Unit %s is masked", *i);
+ return -ENOTSUP;
+ }
+
r = install_info_add_auto(&c, *i);
if (r < 0)
return r;
--
1.7.9.2

View File

@ -1,32 +0,0 @@
From 3e09eb5c83e56bc0184bd9d9c44f76047464f77c Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andreas@fatal.se>
Date: Fri, 13 Jun 2014 18:48:19 +0200
Subject: [PATCH] core: fix invalid free() in killall()
static int killall(....) in ./src/core/killall.c tries to get "s"
initialized by calling get_process_comm(...) which calls
read_one_line_file(...) which if it fails will mean it is left
uninitialized.
It is then used in argument to strna(s) call where it is
dereferenced(!), in addition to nothing else initializing it before
the scope it is in finishes.
---
src/core/killall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/core/killall.c src/core/killall.c
index 57ed41c..eab48f7 100644
--- src/core/killall.c
+++ src/core/killall.c
@@ -168,7 +168,7 @@ static int killall(int sig, Set *pids, bool send_sighup) {
continue;
if (sig == SIGKILL) {
- _cleanup_free_ char *s;
+ _cleanup_free_ char *s = NULL;
get_process_comm(pid, &s);
log_notice("Sending SIGKILL to PID "PID_FMT" (%s).", pid, strna(s));
--
1.7.9.2

View File

@ -1,32 +0,0 @@
From aa9f8a30fd7dc7aa3aa2575b75b3f9a0ab3f02db Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andreas@fatal.se>
Date: Tue, 16 Sep 2014 21:11:02 +0200
Subject: [PATCH] core: fix resource leak in manager_environment_add
Second error path must free the (potentially) allocated memory in the
first code chunk before returning.
Found by coverity. Fixes: CID#1237750
---
src/core/manager.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git src/core/manager.c src/core/manager.c
index 0770727..e0c1cd1 100644
--- src/core/manager.c
+++ src/core/manager.c
@@ -2751,8 +2751,10 @@ int manager_environment_add(Manager *m, char **minus, char **plus) {
if (!strv_isempty(plus)) {
b = strv_env_merge(2, l, plus);
- if (!b)
+ if (!b) {
+ strv_free(a);
return -ENOMEM;
+ }
l = b;
}
--
1.7.9.2

View File

@ -0,0 +1,917 @@
From 628c89cc68ab96fce2de7ebba5933725d147aecc Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 27 Feb 2015 21:55:08 +0100
Subject: [PATCH] core: rework device state logic
References: https://bugzilla.redhat.com/show_bug.cgi?id=1196452
This change introduces a new state "tentative" for device units. Device
units are considered "plugged" when udev announced them, "dead" when
they are not available in the kernel, and "tentative" when they are
referenced in /proc/self/mountinfo or /proc/swaps but not (yet)
announced via udev.
This should fix a race when device nodes (like loop devices) are created
and immediately mounted. Previously, systemd might end up seeing the
mount unit before the device, and would thus pull down the mount because
its BindTo dependency on the device would not be fulfilled.
===
[The bug can be triggered by
cp -a /dev/sda1 (pick any source) /dev/xxx; mount /dev/xxx /mnt;
since "xxx" is a device udev does not know about even if it runs
and is race-free in the moment you are trying.
-jengelh]
---
src/core/device.c | 368 +++++++++++++++++++++++++++++++++---------------------
src/core/device.h | 14 ++-
src/core/mount.c | 46 ++++---
src/core/swap.c | 32 +++--
src/core/swap.h | 4 +-
src/core/unit.c | 1 -
6 files changed, 285 insertions(+), 180 deletions(-)
diff --git a/src/core/device.c b/src/core/device.c
index 2d983cc..e41ed41 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -34,7 +34,8 @@
static const UnitActiveState state_translation_table[_DEVICE_STATE_MAX] = {
[DEVICE_DEAD] = UNIT_INACTIVE,
- [DEVICE_PLUGGED] = UNIT_ACTIVE
+ [DEVICE_TENTATIVE] = UNIT_ACTIVATING,
+ [DEVICE_PLUGGED] = UNIT_ACTIVE,
};
static int device_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata);
@@ -63,6 +64,41 @@ static void device_unset_sysfs(Device *d) {
d->sysfs = NULL;
}
+static int device_set_sysfs(Device *d, const char *sysfs) {
+ Device *first;
+ char *copy;
+ int r;
+
+ assert(d);
+
+ if (streq_ptr(d->sysfs, sysfs))
+ return 0;
+
+ r = hashmap_ensure_allocated(&UNIT(d)->manager->devices_by_sysfs, &string_hash_ops);
+ if (r < 0)
+ return r;
+
+ copy = strdup(sysfs);
+ if (!copy)
+ return -ENOMEM;
+
+ device_unset_sysfs(d);
+
+ first = hashmap_get(UNIT(d)->manager->devices_by_sysfs, sysfs);
+ LIST_PREPEND(same_sysfs, first, d);
+
+ r = hashmap_replace(UNIT(d)->manager->devices_by_sysfs, copy, first);
+ if (r < 0) {
+ LIST_REMOVE(same_sysfs, first, d);
+ free(copy);
+ return r;
+ }
+
+ d->sysfs = copy;
+
+ return 0;
+}
+
static void device_init(Unit *u) {
Device *d = DEVICE(u);
@@ -110,8 +146,13 @@ static int device_coldplug(Unit *u) {
assert(d);
assert(d->state == DEVICE_DEAD);
- if (d->sysfs)
+ if (d->found & DEVICE_FOUND_UDEV)
+ /* If udev says the device is around, it's around */
device_set_state(d, DEVICE_PLUGGED);
+ else if (d->found != DEVICE_NOT_FOUND)
+ /* If a device is found in /proc/self/mountinfo or
+ * /proc/swaps, it's "tentatively" around. */
+ device_set_state(d, DEVICE_TENTATIVE);
return 0;
}
@@ -140,49 +181,9 @@ _pure_ static const char *device_sub_state_to_string(Unit *u) {
return device_state_to_string(DEVICE(u)->state);
}
-static int device_add_escaped_name(Unit *u, const char *dn) {
- _cleanup_free_ char *e = NULL;
- int r;
-
- assert(u);
- assert(dn);
- assert(dn[0] == '/');
-
- e = unit_name_from_path(dn, ".device");
- if (!e)
- return -ENOMEM;
-
- r = unit_add_name(u, e);
- if (r < 0 && r != -EEXIST)
- return r;
-
- return 0;
-}
-
-static int device_find_escape_name(Manager *m, const char *dn, Unit **_u) {
- _cleanup_free_ char *e = NULL;
- Unit *u;
-
- assert(m);
- assert(dn);
- assert(dn[0] == '/');
- assert(_u);
-
- e = unit_name_from_path(dn, ".device");
- if (!e)
- return -ENOMEM;
-
- u = manager_get_unit(m, e);
- if (u) {
- *_u = u;
- return 1;
- }
-
- return 0;
-}
-
-static int device_make_description(Unit *u, struct udev_device *dev, const char *path) {
+static int device_update_description(Unit *u, struct udev_device *dev, const char *path) {
const char *model;
+ int r;
assert(u);
assert(dev);
@@ -207,13 +208,16 @@ static int device_make_description(Unit *u, struct udev_device *dev, const char
j = strjoin(model, " ", label, NULL);
if (j)
- return unit_set_description(u, j);
- }
+ r = unit_set_description(u, j);
+ } else
+ r = unit_set_description(u, model);
+ } else
+ r = unit_set_description(u, path);
- return unit_set_description(u, model);
- }
+ if (r < 0)
+ log_unit_error_errno(u->id, r, "Failed to set device description: %m");
- return unit_set_description(u, path);
+ return r;
}
static int device_add_udev_wants(Unit *u, struct udev_device *dev) {
@@ -240,20 +244,20 @@ static int device_add_udev_wants(Unit *u, struct udev_device *dev) {
n = unit_name_mangle(e, MANGLE_NOGLOB);
if (!n)
- return -ENOMEM;
+ return log_oom();
r = unit_add_dependency_by_name(u, UNIT_WANTS, n, NULL, true);
if (r < 0)
- return r;
+ return log_unit_error_errno(u->id, r, "Failed to add wants dependency: %m");
}
if (!isempty(state))
- log_unit_warning(u->id, "Property %s on %s has trailing garbage, ignoring.",
- property, strna(udev_device_get_syspath(dev)));
+ log_unit_warning(u->id, "Property %s on %s has trailing garbage, ignoring.", property, strna(udev_device_get_syspath(dev)));
return 0;
}
-static int device_update_unit(Manager *m, struct udev_device *dev, const char *path, bool main) {
+static int device_setup_unit(Manager *m, struct udev_device *dev, const char *path, bool main) {
+ _cleanup_free_ char *e = NULL;
const char *sysfs;
Unit *u = NULL;
bool delete;
@@ -267,12 +271,18 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
if (!sysfs)
return 0;
- r = device_find_escape_name(m, path, &u);
- if (r < 0)
- return r;
+ e = unit_name_from_path(path, ".device");
+ if (!e)
+ return log_oom();
+
+ u = manager_get_unit(m, e);
- if (u && DEVICE(u)->sysfs && !path_equal(DEVICE(u)->sysfs, sysfs))
+ if (u &&
+ DEVICE(u)->sysfs &&
+ !path_equal(DEVICE(u)->sysfs, sysfs)) {
+ log_unit_error(u->id, "Device %s appeared twice with different sysfs paths %s and %s", e, DEVICE(u)->sysfs, sysfs);
return -EEXIST;
+ }
if (!u) {
delete = true;
@@ -281,7 +291,7 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
if (!u)
return log_oom();
- r = device_add_escaped_name(u, path);
+ r = unit_add_name(u, e);
if (r < 0)
goto fail;
@@ -293,37 +303,16 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
* actually been seen yet ->sysfs will not be
* initialized. Hence initialize it if necessary. */
- if (!DEVICE(u)->sysfs) {
- Device *first;
-
- DEVICE(u)->sysfs = strdup(sysfs);
- if (!DEVICE(u)->sysfs) {
- r = -ENOMEM;
- goto fail;
- }
-
- r = hashmap_ensure_allocated(&m->devices_by_sysfs, &string_hash_ops);
- if (r < 0)
- goto fail;
-
- first = hashmap_get(m->devices_by_sysfs, sysfs);
- LIST_PREPEND(same_sysfs, first, DEVICE(u));
-
- r = hashmap_replace(m->devices_by_sysfs, DEVICE(u)->sysfs, first);
- if (r < 0)
- goto fail;
- }
-
- device_make_description(u, dev, path);
+ r = device_set_sysfs(DEVICE(u), sysfs);
+ if (r < 0)
+ goto fail;
- if (main) {
- /* The additional systemd udev properties we only
- * interpret for the main object */
+ (void) device_update_description(u, dev, path);
- r = device_add_udev_wants(u, dev);
- if (r < 0)
- goto fail;
- }
+ /* The additional systemd udev properties we only interpret
+ * for the main object */
+ if (main)
+ (void) device_add_udev_wants(u, dev);
/* Note that this won't dispatch the load queue, the caller
* has to do that if needed and appropriate */
@@ -332,7 +321,7 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
return 0;
fail:
- log_warning_errno(r, "Failed to load device unit: %m");
+ log_unit_warning_errno(u->id, r, "Failed to set up device unit: %m");
if (delete && u)
unit_free(u);
@@ -340,7 +329,7 @@ fail:
return r;
}
-static int device_process_new_device(Manager *m, struct udev_device *dev) {
+static int device_process_new(Manager *m, struct udev_device *dev) {
const char *sysfs, *dn, *alias;
struct udev_list_entry *item = NULL, *first = NULL;
int r;
@@ -352,14 +341,14 @@ static int device_process_new_device(Manager *m, struct udev_device *dev) {
return 0;
/* Add the main unit named after the sysfs path */
- r = device_update_unit(m, dev, sysfs, true);
+ r = device_setup_unit(m, dev, sysfs, true);
if (r < 0)
return r;
/* Add an additional unit for the device node */
dn = udev_device_get_devnode(dev);
if (dn)
- device_update_unit(m, dev, dn, false);
+ (void) device_setup_unit(m, dev, dn, false);
/* Add additional units for all symlinks */
first = udev_device_get_devlinks_list_entry(dev);
@@ -386,7 +375,7 @@ static int device_process_new_device(Manager *m, struct udev_device *dev) {
st.st_rdev != udev_device_get_devnum(dev))
continue;
- device_update_unit(m, dev, p, false);
+ (void) device_setup_unit(m, dev, p, false);
}
/* Add additional units for all explicitly configured
@@ -403,7 +392,7 @@ static int device_process_new_device(Manager *m, struct udev_device *dev) {
e[l] = 0;
if (path_is_absolute(e))
- device_update_unit(m, dev, e, false);
+ (void) device_setup_unit(m, dev, e, false);
else
log_warning("SYSTEMD_ALIAS for %s is not an absolute path, ignoring: %s", sysfs, e);
}
@@ -414,39 +403,62 @@ static int device_process_new_device(Manager *m, struct udev_device *dev) {
return 0;
}
-static void device_set_path_plugged(Manager *m, struct udev_device *dev) {
- const char *sysfs;
+static void device_update_found_one(Device *d, bool add, DeviceFound found, bool now) {
+ DeviceFound n;
+
+ assert(d);
+
+ n = add ? (d->found | found) : (d->found & ~found);
+ if (n == d->found)
+ return;
+
+ d->found = n;
+
+ if (now) {
+ if (d->found & DEVICE_FOUND_UDEV)
+ device_set_state(d, DEVICE_PLUGGED);
+ else if (d->found != DEVICE_NOT_FOUND)
+ device_set_state(d, DEVICE_TENTATIVE);
+ else
+ device_set_state(d, DEVICE_DEAD);
+ }
+}
+
+static int device_update_found_by_sysfs(Manager *m, const char *sysfs, bool add, DeviceFound found, bool now) {
Device *d, *l;
assert(m);
- assert(dev);
+ assert(sysfs);
- sysfs = udev_device_get_syspath(dev);
- if (!sysfs)
- return;
+ if (found == DEVICE_NOT_FOUND)
+ return 0;
l = hashmap_get(m->devices_by_sysfs, sysfs);
LIST_FOREACH(same_sysfs, d, l)
- device_set_state(d, DEVICE_PLUGGED);
+ device_update_found_one(d, add, found, now);
+
+ return 0;
}
-static int device_process_removed_device(Manager *m, struct udev_device *dev) {
- const char *sysfs;
- Device *d;
+static int device_update_found_by_name(Manager *m, const char *path, bool add, DeviceFound found, bool now) {
+ _cleanup_free_ char *e = NULL;
+ Unit *u;
assert(m);
- assert(dev);
+ assert(path);
- sysfs = udev_device_get_syspath(dev);
- if (!sysfs)
- return -ENOMEM;
+ if (found == DEVICE_NOT_FOUND)
+ return 0;
- /* Remove all units of this sysfs path */
- while ((d = hashmap_get(m->devices_by_sysfs, sysfs))) {
- device_unset_sysfs(d);
- device_set_state(d, DEVICE_DEAD);
- }
+ e = unit_name_from_path(path, ".device");
+ if (!e)
+ return log_oom();
+ u = manager_get_unit(m, e);
+ if (!u)
+ return 0;
+
+ device_update_found_one(DEVICE(u), add, found, now);
return 0;
}
@@ -462,22 +474,6 @@ static bool device_is_ready(struct udev_device *dev) {
return parse_boolean(ready) != 0;
}
-static int device_process_new_path(Manager *m, const char *path) {
- _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
-
- assert(m);
- assert(path);
-
- dev = udev_device_new_from_syspath(m->udev, path);
- if (!dev)
- return log_oom();
-
- if (!device_is_ready(dev))
- return 0;
-
- return device_process_new_device(m, dev);
-}
-
static Unit *device_following(Unit *u) {
Device *d = DEVICE(u);
Device *other, *first = NULL;
@@ -604,12 +600,31 @@ static int device_enumerate(Manager *m) {
goto fail;
first = udev_enumerate_get_list_entry(e);
- udev_list_entry_foreach(item, first)
- device_process_new_path(m, udev_list_entry_get_name(item));
+ udev_list_entry_foreach(item, first) {
+ _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+ const char *sysfs;
+
+ sysfs = udev_list_entry_get_name(item);
+
+ dev = udev_device_new_from_syspath(m->udev, sysfs);
+ if (!dev) {
+ log_oom();
+ continue;
+ }
+
+ if (!device_is_ready(dev))
+ continue;
+
+ (void) device_process_new(m, dev);
+
+ device_update_found_by_sysfs(m, sysfs, true, DEVICE_FOUND_UDEV, false);
+ }
return 0;
fail:
+ log_error_errno(r, "Failed to enumerate devices: %m");
+
device_shutdown(m);
return r;
}
@@ -617,7 +632,7 @@ fail:
static int device_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
_cleanup_udev_device_unref_ struct udev_device *dev = NULL;
Manager *m = userdata;
- const char *action;
+ const char *action, *sysfs;
int r;
assert(m);
@@ -639,33 +654,47 @@ static int device_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
if (!dev)
return 0;
+ sysfs = udev_device_get_syspath(dev);
+ if (!sysfs) {
+ log_error("Failed to get udev sys path.");
+ return 0;
+ }
+
action = udev_device_get_action(dev);
if (!action) {
log_error("Failed to get udev action string.");
return 0;
}
- if (streq(action, "remove") || !device_is_ready(dev)) {
- r = device_process_removed_device(m, dev);
- if (r < 0)
- log_error_errno(r, "Failed to process device remove event: %m");
-
- r = swap_process_removed_device(m, dev);
+ if (streq(action, "remove")) {
+ r = swap_process_device_remove(m, dev);
if (r < 0)
log_error_errno(r, "Failed to process swap device remove event: %m");
- } else {
- r = device_process_new_device(m, dev);
- if (r < 0)
- log_error_errno(r, "Failed to process device new event: %m");
+ /* If we get notified that a device was removed by
+ * udev, then it's completely gone, hence unset all
+ * found bits */
+ device_update_found_by_sysfs(m, sysfs, false, DEVICE_FOUND_UDEV|DEVICE_FOUND_MOUNT|DEVICE_FOUND_SWAP, true);
- r = swap_process_new_device(m, dev);
+ } else if (device_is_ready(dev)) {
+
+ (void) device_process_new(m, dev);
+
+ r = swap_process_device_new(m, dev);
if (r < 0)
log_error_errno(r, "Failed to process swap device new event: %m");
manager_dispatch_load_queue(m);
- device_set_path_plugged(m, dev);
+ /* The device is found now, set the udev found bit */
+ device_update_found_by_sysfs(m, sysfs, true, DEVICE_FOUND_UDEV, true);
+
+ } else {
+ /* The device is nominally around, but not ready for
+ * us. Hence unset the udev bit, but leave the rest
+ * around. */
+
+ device_update_found_by_sysfs(m, sysfs, false, DEVICE_FOUND_UDEV, true);
}
return 0;
@@ -684,9 +713,58 @@ static bool device_supported(Manager *m) {
return read_only <= 0;
}
+int device_found_node(Manager *m, const char *node, bool add, DeviceFound found, bool now) {
+ _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+ struct stat st;
+
+ assert(m);
+ assert(node);
+
+ /* This is called whenever we find a device referenced in
+ * /proc/swaps or /proc/self/mounts. Such a device might be
+ * mounted/enabled at a time where udev has not finished
+ * probing it yet, and we thus haven't learned about it
+ * yet. In this case we will set the device unit to
+ * "tentative" state. */
+
+ if (add) {
+ if (!path_startswith(node, "/dev"))
+ return 0;
+
+ if (stat(node, &st) < 0) {
+ if (errno == ENOENT)
+ return 0;
+
+ return log_error_errno(errno, "Failed to stat device node file %s: %m", node);
+ }
+
+ if (!S_ISBLK(st.st_mode) && !S_ISCHR(st.st_mode))
+ return 0;
+
+ dev = udev_device_new_from_devnum(m->udev, S_ISBLK(st.st_mode) ? 'b' : 'c', st.st_rdev);
+ if (!dev) {
+ if (errno == ENOENT)
+ return 0;
+
+ return log_oom();
+ }
+
+ /* If the device is known in the kernel and newly
+ * appeared, then we'll create a device unit for it,
+ * under the name referenced in /proc/swaps or
+ * /proc/self/mountinfo. */
+
+ (void) device_setup_unit(m, dev, node, false);
+ }
+
+ /* Update the device unit's state, should it exist */
+ return device_update_found_by_name(m, node, add, found, now);
+}
+
static const char* const device_state_table[_DEVICE_STATE_MAX] = {
[DEVICE_DEAD] = "dead",
- [DEVICE_PLUGGED] = "plugged"
+ [DEVICE_TENTATIVE] = "tentative",
+ [DEVICE_PLUGGED] = "plugged",
};
DEFINE_STRING_TABLE_LOOKUP(device_state, DeviceState);
diff --git a/src/core/device.h b/src/core/device.h
index 9065085..9f46e08 100644
--- a/src/core/device.h
+++ b/src/core/device.h
@@ -28,20 +28,28 @@ typedef struct Device Device;
* simplifies the state engine greatly */
typedef enum DeviceState {
DEVICE_DEAD,
- DEVICE_PLUGGED,
+ DEVICE_TENTATIVE, /* mounted or swapped, but not (yet) announced by udev */
+ DEVICE_PLUGGED, /* announced by udev */
_DEVICE_STATE_MAX,
_DEVICE_STATE_INVALID = -1
} DeviceState;
+typedef enum DeviceFound {
+ DEVICE_NOT_FOUND = 0,
+ DEVICE_FOUND_UDEV = 1,
+ DEVICE_FOUND_MOUNT = 2,
+ DEVICE_FOUND_SWAP = 4,
+} DeviceFound;
+
struct Device {
Unit meta;
char *sysfs;
+ DeviceFound found;
/* In order to be able to distinguish dependencies on
different device nodes we might end up creating multiple
devices for the same sysfs path. We chain them up here. */
-
LIST_FIELDS(struct Device, same_sysfs);
DeviceState state;
@@ -51,3 +59,5 @@ extern const UnitVTable device_vtable;
const char* device_state_to_string(DeviceState i) _const_;
DeviceState device_state_from_string(const char *s) _pure_;
+
+int device_found_node(Manager *m, const char *node, bool add, DeviceFound found, bool now);
diff --git a/src/core/mount.c b/src/core/mount.c
index 40037e7..8e4a376 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1386,7 +1386,7 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user
return 0;
}
-static int mount_add_one(
+static int mount_setup_unit(
Manager *m,
const char *what,
const char *where,
@@ -1429,7 +1429,7 @@ static int mount_add_one(
u = unit_new(m, sizeof(Mount));
if (!u)
- return -ENOMEM;
+ return log_oom();
r = unit_add_name(u, e);
if (r < 0)
@@ -1542,6 +1542,8 @@ static int mount_add_one(
return 0;
fail:
+ log_warning_errno(r, "Failed to set up mount unit: %m");
+
if (delete && u)
unit_free(u);
@@ -1549,33 +1551,36 @@ fail:
}
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
- _cleanup_(mnt_free_tablep) struct libmnt_table *tb = NULL;
- _cleanup_(mnt_free_iterp) struct libmnt_iter *itr = NULL;
- struct libmnt_fs *fs;
+ _cleanup_(mnt_free_tablep) struct libmnt_table *t = NULL;
+ _cleanup_(mnt_free_iterp) struct libmnt_iter *i = NULL;
int r = 0;
assert(m);
- tb = mnt_new_table();
- itr = mnt_new_iter(MNT_ITER_FORWARD);
- if (!tb || !itr)
+ t = mnt_new_table();
+ if (!t)
return log_oom();
- r = mnt_table_parse_mtab(tb, NULL);
+ i = mnt_new_iter(MNT_ITER_FORWARD);
+ if (!i)
+ return log_oom();
+
+ r = mnt_table_parse_mtab(t, NULL);
if (r < 0)
- return r;
+ return log_error_errno(r, "Failed to parse /proc/self/mountinfo: %m");
r = 0;
for (;;) {
const char *device, *path, *options, *fstype;
_cleanup_free_ const char *d = NULL, *p = NULL;
+ struct libmnt_fs *fs;
int k;
- k = mnt_table_next_fs(tb, itr, &fs);
+ k = mnt_table_next_fs(t, i, &fs);
if (k == 1)
break;
- else if (k < 0)
- return log_error_errno(k, "Failed to get next entry from /etc/fstab: %m");
+ if (k < 0)
+ return log_error_errno(k, "Failed to get next entry from /proc/self/mountinfo: %m");
device = mnt_fs_get_source(fs);
path = mnt_fs_get_target(fs);
@@ -1583,11 +1588,16 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
fstype = mnt_fs_get_fstype(fs);
d = cunescape(device);
+ if (!d)
+ return log_oom();
+
p = cunescape(path);
- if (!d || !p)
+ if (!p)
return log_oom();
- k = mount_add_one(m, d, p, options, fstype, set_flags);
+ (void) device_found_node(m, d, true, DEVICE_FOUND_MOUNT, set_flags);
+
+ k = mount_setup_unit(m, d, p, options, fstype, set_flags);
if (r == 0 && k < 0)
r = k;
}
@@ -1731,8 +1741,6 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
r = mount_load_proc_self_mountinfo(m, true);
if (r < 0) {
- log_error_errno(r, "Failed to reread /proc/self/mountinfo: %m");
-
/* Reset flags, just in case, for later calls */
LIST_FOREACH(units_by_type, u, m->units_by_type[UNIT_MOUNT]) {
Mount *mount = MOUNT(u);
@@ -1765,6 +1773,10 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
break;
}
+ if (mount->parameters_proc_self_mountinfo.what)
+ (void) device_found_node(m, mount->parameters_proc_self_mountinfo.what, false, DEVICE_FOUND_MOUNT, true);
+
+
} else if (mount->just_mounted || mount->just_changed) {
/* New or changed mount entry */
diff --git a/src/core/swap.c b/src/core/swap.c
index f73a8e6..de3a5d8 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -331,7 +331,7 @@ static int swap_load(Unit *u) {
return swap_verify(s);
}
-static int swap_add_one(
+static int swap_setup_unit(
Manager *m,
const char *what,
const char *what_proc_swaps,
@@ -356,8 +356,10 @@ static int swap_add_one(
if (u &&
SWAP(u)->from_proc_swaps &&
- !path_equal(SWAP(u)->parameters_proc_swaps.what, what_proc_swaps))
+ !path_equal(SWAP(u)->parameters_proc_swaps.what, what_proc_swaps)) {
+ log_error("Swap %s appeared twice with different device paths %s and %s", e, SWAP(u)->parameters_proc_swaps.what, what_proc_swaps);
return -EEXIST;
+ }
if (!u) {
delete = true;
@@ -372,7 +374,7 @@ static int swap_add_one(
SWAP(u)->what = strdup(what);
if (!SWAP(u)->what) {
- r = log_oom();
+ r = -ENOMEM;
goto fail;
}
@@ -400,7 +402,6 @@ static int swap_add_one(
p->priority = priority;
unit_add_to_dbus_queue(u);
-
return 0;
fail:
@@ -412,7 +413,7 @@ fail:
return r;
}
-static int swap_process_new_swap(Manager *m, const char *device, int prio, bool set_flags) {
+static int swap_process_new(Manager *m, const char *device, int prio, bool set_flags) {
_cleanup_udev_device_unref_ struct udev_device *d = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
const char *dn;
@@ -421,7 +422,7 @@ static int swap_process_new_swap(Manager *m, const char *device, int prio, bool
assert(m);
- r = swap_add_one(m, device, device, prio, set_flags);
+ r = swap_setup_unit(m, device, device, prio, set_flags);
if (r < 0)
return r;
@@ -437,7 +438,7 @@ static int swap_process_new_swap(Manager *m, const char *device, int prio, bool
/* Add the main device node */
dn = udev_device_get_devnode(d);
if (dn && !streq(dn, device))
- swap_add_one(m, dn, device, prio, set_flags);
+ swap_setup_unit(m, dn, device, prio, set_flags);
/* Add additional units for all symlinks */
first = udev_device_get_devlinks_list_entry(d);
@@ -458,7 +459,7 @@ static int swap_process_new_swap(Manager *m, const char *device, int prio, bool
st.st_rdev != udev_device_get_devnum(d))
continue;
- swap_add_one(m, p, device, prio, set_flags);
+ swap_setup_unit(m, p, device, prio, set_flags);
}
return r;
@@ -1084,15 +1085,17 @@ static int swap_load_proc_swaps(Manager *m, bool set_flags) {
if (k == EOF)
break;
- log_warning("Failed to parse /proc/swaps:%u", i);
+ log_warning("Failed to parse /proc/swaps:%u.", i);
continue;
}
d = cunescape(dev);
if (!d)
- return -ENOMEM;
+ return log_oom();
+
+ device_found_node(m, d, true, DEVICE_FOUND_SWAP, set_flags);
- k = swap_process_new_swap(m, d, prio, set_flags);
+ k = swap_process_new(m, d, prio, set_flags);
if (k < 0)
r = k;
}
@@ -1144,6 +1147,9 @@ static int swap_dispatch_io(sd_event_source *source, int fd, uint32_t revents, v
break;
}
+ if (swap->what)
+ device_found_node(m, swap->what, false, DEVICE_FOUND_SWAP, true);
+
} else if (swap->just_activated) {
/* New swap entry */
@@ -1291,7 +1297,7 @@ fail:
return r;
}
-int swap_process_new_device(Manager *m, struct udev_device *dev) {
+int swap_process_device_new(Manager *m, struct udev_device *dev) {
struct udev_list_entry *item = NULL, *first = NULL;
_cleanup_free_ char *e = NULL;
const char *dn;
@@ -1334,7 +1340,7 @@ int swap_process_new_device(Manager *m, struct udev_device *dev) {
return r;
}
-int swap_process_removed_device(Manager *m, struct udev_device *dev) {
+int swap_process_device_remove(Manager *m, struct udev_device *dev) {
const char *dn;
int r = 0;
Swap *s;
diff --git a/src/core/swap.h b/src/core/swap.h
index c36c6f2..5de8c20 100644
--- a/src/core/swap.h
+++ b/src/core/swap.h
@@ -115,8 +115,8 @@ struct Swap {
extern const UnitVTable swap_vtable;
-int swap_process_new_device(Manager *m, struct udev_device *dev);
-int swap_process_removed_device(Manager *m, struct udev_device *dev);
+int swap_process_device_new(Manager *m, struct udev_device *dev);
+int swap_process_device_remove(Manager *m, struct udev_device *dev);
const char* swap_state_to_string(SwapState i) _const_;
SwapState swap_state_from_string(const char *s) _pure_;
diff --git a/src/core/unit.c b/src/core/unit.c
index 63ccd67..7cd7043 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2834,7 +2834,6 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) {
return -ENOMEM;
r = manager_load_unit(u->manager, e, NULL, NULL, &device);
-
if (r < 0)
return r;
--
2.1.4

View File

@ -1,76 +0,0 @@
From 3018d31238caabc2e204aa161e647dc1c1b5d1c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 2 Oct 2014 00:11:36 -0400
Subject: [PATCH] core/swap: only make configured units part of swap.target
We used to make all .swap units either RequiredBy=swap.target or
WantedBy=swap.target. But swap.target should be the "configured swap
units", either through /etc/fstab or non-generated .swap units. It
is surprising when systemd starts treating a swap device that was
possibly temporarily enabled as a hard dependency for other units.
So do not add dependencies with swap.target for units gleaned from
/proc/swaps.
Similarly, we added dependencies for all aliases of the device name,
which clutters up the dependency graph but does not seem to bring any
value, since the status of those following units is consistent with
the main one anyway.
This should be a fix for [1], and it seems the right thing to do
anyway.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1114786
---
src/core/swap.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git src/core/swap.c src/core/swap.c
index ef90d0e..b2ca048 100644
--- src/core/swap.c
+++ src/core/swap.c
@@ -213,7 +213,7 @@ static int swap_add_device_links(Swap *s) {
}
static int swap_add_default_dependencies(Swap *s) {
- bool nofail = false, noauto = false;
+ bool nofail, noauto;
int r;
assert(s);
@@ -228,23 +228,25 @@ static int swap_add_default_dependencies(Swap *s) {
if (r < 0)
return r;
- if (s->from_fragment) {
- SwapParameters *p = &s->parameters_fragment;
+ if (!s->from_fragment)
+ /* The swap unit can either be for an alternative device name, in which
+ * case we don't need to add the dependency on swap.target because this unit
+ * is following a different unit which will have this dependency added,
+ * or it can be derived from /proc/swaps, in which case it was started
+ * manually, and should not become a dependency of swap.target. */
+ return 0;
- nofail = p->nofail;
- noauto = p->noauto;
- }
+ nofail = s->parameters_fragment.nofail;
+ noauto = s->parameters_fragment.noauto;
if (!noauto) {
if (nofail)
r = unit_add_dependency_by_name_inverse(UNIT(s), UNIT_WANTS, SPECIAL_SWAP_TARGET, NULL, true);
else
r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SWAP_TARGET, NULL, true);
- if (r < 0)
- return r;
}
- return 0;
+ return r < 0 ? r : 0;
}
static int swap_verify(Swap *s) {
--
1.7.9.2

View File

@ -1,51 +0,0 @@
From 0404c609f399b2092a3de52eef9d75b0dc12e94c Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Mon, 12 May 2014 21:26:54 +0200
Subject: [PATCH] core: sysvcompat - $network should be equivalent to
network-online, rather than network target
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Most likely the facility needed is actual connectivity, rather than whether or not the
network managment daemon is running.
We also need to explicitly pull in the network-online.target, as it is not active by
default.
This means {systemd-networkd,NetworkManager}-wait-online.service, can be enabled by default
as part of network-online.target, and only delay boot when some service actively pulls it in.
See: <https://bugzilla.gnome.org/show_bug.cgi?id=728965>
Cc: Pavel Šimerda <psimerda@redhat.com>
Cc: Michal Sekletar <msekleta@redhat.com>
---
TODO | 4 ----
src/core/service.c | 8 ++++++--
2 files changed, 6 insertions(+), 6 deletions(-)
Modified by Andrey Borzenkov <arvidjaar@gmail.com> for openSUSE.
Index: systemd-210/src/core/service.c
===================================================================
--- systemd-210.orig/src/core/service.c
+++ systemd-210/src/core/service.c
@@ -404,7 +404,7 @@ static int sysv_translate_facility(const
static const char * const table[] = {
/* LSB defined facilities */
"local_fs", NULL,
- "network", SPECIAL_NETWORK_TARGET,
+ "network", SPECIAL_NETWORK_ONLINE_TARGET,
"named", SPECIAL_NSS_LOOKUP_TARGET,
"portmap", SPECIAL_RPCBIND_TARGET,
"remote_fs", SPECIAL_REMOTE_FS_TARGET,
@@ -881,6 +881,9 @@ static int service_load_sysv_path(Servic
if (r == 0)
continue;
+ if (streq(m, SPECIAL_NETWORK_ONLINE_TARGET) && d == UNIT_AFTER && e == _UNIT_DEPENDENCY_INVALID)
+ e = UNIT_WANTS;
+
if (e != _UNIT_DEPENDENCY_INVALID)
r = unit_add_two_dependencies_by_name(u, d, e, m, NULL, true);
else

View File

@ -1,20 +0,0 @@
Based on d6239dc4b0cf55a953d6c40890859b85d504ef19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Bartoszkiewicz?= <mbartoszkiewicz@gmail.com>
Date: Wed, 25 Jun 2014 14:54:48 +0200
Subject: [PATCH] core: use correct format string for UIDs
---
src/core/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- src/core/main.c
+++ src/core/main.c 2014-06-26 09:29:28.182235325 +0000
@@ -1526,7 +1526,7 @@ int main(int argc, char *argv[]) {
} else {
_cleanup_free_ char *t = uid_to_name(getuid());
- log_debug(PACKAGE_STRING " running in user mode for user "PID_FMT"/%s. (" SYSTEMD_FEATURES ")",
+ log_debug(PACKAGE_STRING " running in user mode for user "UID_FMT"/%s. (" SYSTEMD_FEATURES ")",
getuid(), t);
}

View File

@ -1,33 +0,0 @@
From a71516dfd1858f37712ef52a288bf5fb274383e0 Mon Sep 17 00:00:00 2001
From: Thomas Blume <Thomas.Blume@suse.com>
Date: Thu, 17 Jul 2014 11:25:37 +0200
Subject: [PATCH] detect-virt: Fix Xen domU discovery
The conditional for detection xen virtualization contained a little mistake.
It is checking for i to be empty: 'if (!i) {', but it must check for cap instead,
because: 'cap = strsep(&i, ",")' will set cap to the discovered value and i to
the next value after the separator.
Hence, i would be empty, if there is only control_d in domcap, leading to a wrong
domU detection.
https://bugs.freedesktop.org/show_bug.cgi?id=77271
---
src/shared/virt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/shared/virt.c src/shared/virt.c
index 774915f..20a8d7c 100644
--- src/shared/virt.c
+++ src/shared/virt.c
@@ -173,7 +173,7 @@ int detect_vm(const char **id) {
if (streq(cap, "control_d"))
break;
- if (!i) {
+ if (!cap) {
_id = "xen";
r = 1;
}
--
1.7.9.2

View File

@ -1,30 +0,0 @@
Based on 0d522a7a0547982eae9ab1b5971e4bed9c2fbc7c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 24 Apr 2014 08:11:39 +0200
Subject: [PATCH] errno: make sure to handle the 3 errnos that are aliases for
others properly
---
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- Makefile.am
+++ Makefile.am 2014-05-12 00:00:00.000000000 +0000
@@ -1078,7 +1078,7 @@ BUILT_SOURCES += \
src/shared/errno-list.txt:
$(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - < /dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+[0-9]/ { print $$2; }' > $@
+ $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - < /dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' > $@
src/shared/errno-from-name.gperf: src/shared/errno-list.txt
$(AM_V_at)$(MKDIR_P) $(dir $@)
@@ -1090,7 +1090,7 @@ src/shared/errno-from-name.h: src/shared
src/shared/errno-to-name.h: src/shared/errno-list.txt
$(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' < $< > $@
+ $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' < $< > $@
# ------------------------------------------------------------------------------
systemd_SOURCES = \

View File

@ -1,24 +0,0 @@
From 138992534878483de28417dfc61c546bba5cb8ad Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 10 Jul 2014 18:25:08 +0200
Subject: [PATCH] event: pull in sd-event.h from event-util.h
---
src/libsystemd/sd-event/event-util.h | 1 +
1 file changed, 1 insertion(+)
diff --git src/libsystemd/sd-event/event-util.h src/libsystemd/sd-event/event-util.h
index e58020d..e7cad9b 100644
--- src/libsystemd/sd-event/event-util.h
+++ src/libsystemd/sd-event/event-util.h
@@ -22,6 +22,7 @@
***/
#include "util.h"
+#include "sd-event.h"
DEFINE_TRIVIAL_CLEANUP_FUNC(sd_event*, sd_event_unref);
DEFINE_TRIVIAL_CLEANUP_FUNC(sd_event_source*, sd_event_source_unref);
--
1.7.9.2

View File

@ -1,20 +0,0 @@
From 9c4495ca561624c2f0085507dd1288ed5f1247c5 Mon Sep 17 00:00:00 2001
From: Tomasz Torcz <tomek@pipebreaker.pl>
Date: Wed, 12 Mar 2014 19:25:11 +0100
Subject: [PATCH] gpt-auto-generator: don't return OOM on parentless devices
---
src/gpt-auto-generator/gpt-auto-generator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- src/gpt-auto-generator/gpt-auto-generator.c
+++ src/gpt-auto-generator/gpt-auto-generator.c 2014-03-18 13:35:11.438235125 +0000
@@ -254,7 +254,7 @@ static int enumerate_partitions(struct u
parent = udev_device_get_parent(d);
if (!parent)
- return log_oom();
+ return 0;
r = udev_enumerate_add_match_parent(e, parent);
if (r < 0)

View File

@ -1,29 +0,0 @@
From e525326bd07ebf3cabcfd730bc479166723f2d44 Mon Sep 17 00:00:00 2001
From: Marcel Holtmann <marcel@holtmann.org>
Date: Sun, 2 Mar 2014 10:02:10 -0800
Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
---
hwdb/20-bluetooth-vendor-product.hwdb | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git hwdb/20-bluetooth-vendor-product.hwdb hwdb/20-bluetooth-vendor-product.hwdb
index db3bc24..0335a71 100644
--- hwdb/20-bluetooth-vendor-product.hwdb
+++ hwdb/20-bluetooth-vendor-product.hwdb
@@ -902,3 +902,12 @@ bluetooth:v0129*
bluetooth:v012A*
ID_VENDOR_FROM_DATABASE=Changzhou Yongse Infotech Co., Ltd
+
+bluetooth:v012B*
+ ID_VENDOR_FROM_DATABASE=SportIQ
+
+bluetooth:v012C*
+ ID_VENDOR_FROM_DATABASE=TEMEC Instruments B.V.
+
+bluetooth:v012D*
+ ID_VENDOR_FROM_DATABASE=Sony Corporation
--
1.7.9.2

View File

@ -1,25 +0,0 @@
From 4c02dd7153f970244950b5e00f7bdfea8d2ff0be Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Wed, 4 Jun 2014 17:55:14 +0200
Subject: [PATCH] hwdb: fix case-sensitive match
---
hwdb/60-keyboard.hwdb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb
index d053766..c7ff4e4 100644
--- hwdb/60-keyboard.hwdb
+++ hwdb/60-keyboard.hwdb
@@ -870,7 +870,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svnOQO*Inc.*:pnOQO*Model*2*:pvr*
###########################################################
# Plantronics .Audio 626 DSP
-keyboard:usb:v047fpC006*
+keyboard:usb:v047FpC006*
KEYBOARD_KEY_b002f=f20 # Microphone mute button; should be micmute
###########################################################
--
1.7.9.2

View File

@ -1,40 +0,0 @@
From 77e8ff6974ffaa6c9954e3d2264d9aa75ef25233 Mon Sep 17 00:00:00 2001
From: Kieran Clancy <clancy.kieran@gmail.com>
Date: Thu, 27 Feb 2014 16:02:57 +1030
Subject: [PATCH] hwdb: keymaps for Samsung 900X3E/900X3F
Keymaps for Samsung 900X3E and 900X3F should be the same as for other
models in the series.
I have also moved the comment for '# Series 9' to the right place
---
hwdb/60-keyboard.hwdb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb
index edfa842..bd8fd10 100644
--- hwdb/60-keyboard.hwdb
+++ hwdb/60-keyboard.hwdb
@@ -897,9 +897,10 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*550P*:pvr*
KEYBOARD_KEY_a8=! # Fn Lock - Function lock on
KEYBOARD_KEY_a9=! # Fn Lock - Function lock off
+# Series 7 / 9
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700Z*:pvr*
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700G*:pvr*
-keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34][CDG]*:pvr*
+keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34][CDEFG]*:pvr*
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*940X3G*:pvr*
KEYBOARD_KEY_ce=!prog1 # Fn+F1 launch settings
KEYBOARD_KEY_a0=!mute # Fn+F6 mute
@@ -909,7 +910,6 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*940X3G*:pvr*
KEYBOARD_KEY_96=!kbdillumup # Fn+F10 keyboard backlight up
KEYBOARD_KEY_b3=!prog3 # Fn+F11 fan/cooling mode changer
-# Series 9
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34][AB]*:pvr*
KEYBOARD_KEY_ce=! # Fn+F8 keyboard backlight up
KEYBOARD_KEY_8d=! # Fn+F7 keyboard backlight down
--
1.7.9.2

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
From f3b8fbb1da6519e14985ea444f8304673d20ad3f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 3 Sep 2014 13:28:31 +0200
Subject: [PATCH] initrd-parse-etc.service: ignore return code of
daemon-reload
It seems the return code of systemctl daemon-reload can be !=0 in some
circumstances, which causes a failure of the unit and breaks booting in
the initrd.
---
units/initrd-parse-etc.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git units/initrd-parse-etc.service.in units/initrd-parse-etc.service.in
index c0b2543..42c059b 100644
--- units/initrd-parse-etc.service.in
+++ units/initrd-parse-etc.service.in
@@ -16,7 +16,7 @@ ConditionPathExists=/etc/initrd-release
[Service]
Type=oneshot
-ExecStartPre=@rootbindir@/systemctl daemon-reload
+ExecStartPre=-@rootbindir@/systemctl daemon-reload
# we have to retrigger initrd-fs.target after daemon-reload
ExecStart=-@rootbindir@/systemctl --no-block start initrd-fs.target
ExecStart=@rootbindir@/systemctl --no-block start initrd-cleanup.service
--
1.7.9.2

View File

@ -1,30 +0,0 @@
From e8c108ca9f11a382742f212f5b42a02536b3d40f Mon Sep 17 00:00:00 2001
From: Philippe De Swert <philippedeswert@gmail.com>
Date: Wed, 17 Sep 2014 00:27:16 +0300
Subject: [PATCH] journal: Do not count on the compiler initializing
found_last to false
There is a very unlikely case where this can happen since gcc usually
does the sane thing. But let's make sure found_last is initialized anyway.
Fixes: CID#996386
---
src/journal/journal-verify.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/journal/journal-verify.c src/journal/journal-verify.c
index 6c8ca8c..b4e8f73 100644
--- src/journal/journal-verify.c
+++ src/journal/journal-verify.c
@@ -804,7 +804,7 @@ int journal_file_verify(
usec_t last_usec = 0;
int data_fd = -1, entry_fd = -1, entry_array_fd = -1;
unsigned i;
- bool found_last;
+ bool found_last = false;
#ifdef HAVE_GCRYPT
uint64_t last_tag = 0;
#endif
--
1.7.9.2

View File

@ -1,104 +0,0 @@
From e3b9d9c8027a7c4c55cf1614e0fe9423fad69e8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 11 Apr 2014 08:44:55 -0400
Subject: [PATCH] journal: cleanup up error handling in update_catalog()
- Negative/positive errno mixup caused duplicates not to be detected properly.
Now we get a warning about some duplicate entries in our own catalogs...
- Errors in update_catalog would be ignored, but they should not be.
---
src/journal/catalog.c | 25 +++++++++++++------------
src/journal/test-catalog.c | 3 ++-
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git src/journal/catalog.c src/journal/catalog.c
index 3ed0b7e..02dedc4 100644
--- src/journal/catalog.c
+++ src/journal/catalog.c
@@ -103,7 +103,7 @@ static int finish_item(
const char *payload) {
ssize_t offset;
- CatalogItem *i;
+ _cleanup_free_ CatalogItem *i = NULL;
int r;
assert(h);
@@ -126,13 +126,14 @@ static int finish_item(
i->offset = htole64((uint64_t) offset);
r = hashmap_put(h, i, i);
- if (r == EEXIST) {
+ if (r == -EEXIST) {
log_warning("Duplicate entry for " SD_ID128_FORMAT_STR ".%s, ignoring.",
SD_ID128_FORMAT_VAL(id), language ? language : "C");
- free(i);
return 0;
- }
+ } else if (r < 0)
+ return r;
+ i = NULL;
return 0;
}
@@ -383,8 +384,8 @@ error:
int catalog_update(const char* database, const char* root, const char* const* dirs) {
_cleanup_strv_free_ char **files = NULL;
char **f;
- Hashmap *h;
struct strbuf *sb = NULL;
+ _cleanup_hashmap_free_free_ Hashmap *h = NULL;
_cleanup_free_ CatalogItem *items = NULL;
CatalogItem *i;
Iterator j;
@@ -406,13 +407,17 @@ int catalog_update(const char* database, const char* root, const char* const* di
}
STRV_FOREACH(f, files) {
- log_debug("reading file '%s'", *f);
- catalog_import_file(h, sb, *f);
+ log_debug("Reading file '%s'", *f);
+ r = catalog_import_file(h, sb, *f);
+ if (r < 0) {
+ log_error("Failed to import file '%s': %s.",
+ *f, strerror(-r));
+ goto finish;
+ }
}
if (hashmap_size(h) <= 0) {
log_info("No items in catalog.");
- r = 0;
goto finish;
} else
log_debug("Found %u items in catalog.", hashmap_size(h));
@@ -443,11 +448,7 @@ int catalog_update(const char* database, const char* root, const char* const* di
log_debug("%s: wrote %u items, with %zu bytes of strings, %ld total size.",
database, n, sb->len, r);
- r = 0;
-
finish:
- if (h)
- hashmap_free_free(h);
if (sb)
strbuf_cleanup(sb);
diff --git src/journal/test-catalog.c src/journal/test-catalog.c
index b087a8b..967ab67 100644
--- src/journal/test-catalog.c
+++ src/journal/test-catalog.c
@@ -157,7 +157,8 @@ int main(int argc, char *argv[]) {
setlocale(LC_ALL, "de_DE.UTF-8");
- log_set_max_level(LOG_DEBUG);
+ log_parse_environment();
+ log_open();
test_catalog_file_lang();
--
1.7.9.2

View File

@ -1,186 +0,0 @@
Based on 5e592c66bdf76dfc8445b332f7a5088ca504ee90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 4 Jul 2014 19:53:58 -0400
Subject: [PATCH] journal/compress: return early in uncompress_startswith
uncompress_startswith would always decode the whole stream, even
if it did not start with the given prefix.
Reallocation policy was also strange.
---
src/journal/compress.c | 91 ++++++++++++++-----------------------------------
1 file changed, 27 insertions(+), 64 deletions(-)
Index: src/journal/compress.c
===================================================================
--- src/journal/compress.c.orig
+++ src/journal/compress.c
@@ -25,6 +25,7 @@
#include <lzma.h>
#include "macro.h"
+#include "util.h"
#include "compress.h"
bool compress_blob(const void *src, uint64_t src_size, void *dst, uint64_t *dst_size) {
@@ -69,10 +70,9 @@ fail:
bool uncompress_blob(const void *src, uint64_t src_size,
void **dst, uint64_t *dst_alloc_size, uint64_t* dst_size, uint64_t dst_max) {
- lzma_stream s = LZMA_STREAM_INIT;
+ _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
lzma_ret ret;
uint64_t space;
- bool b = false;
assert(src);
assert(src_size > 0);
@@ -85,26 +85,18 @@ bool uncompress_blob(const void *src, ui
if (ret != LZMA_OK)
return false;
- if (*dst_alloc_size <= src_size) {
- void *p;
-
- p = realloc(*dst, src_size*2);
- if (!p)
- return false;
-
- *dst = p;
- *dst_alloc_size = src_size*2;
- }
+ space = MIN(src_size * 2, dst_max ?: (uint64_t) -1);
+ if (!greedy_realloc(dst, dst_alloc_size, space))
+ return false;
s.next_in = src;
s.avail_in = src_size;
s.next_out = *dst;
- space = dst_max > 0 ? MIN(*dst_alloc_size, dst_max) : *dst_alloc_size;
s.avail_out = space;
for (;;) {
- void *p;
+ uint64_t used;
ret = lzma_code(&s, LZMA_FINISH);
@@ -112,31 +104,25 @@ bool uncompress_blob(const void *src, ui
break;
if (ret != LZMA_OK)
- goto fail;
+ return false;
if (dst_max > 0 && (space - s.avail_out) >= dst_max)
break;
- p = realloc(*dst, space*2);
- if (!p)
- goto fail;
-
- s.next_out = (uint8_t*) p + ((uint8_t*) s.next_out - (uint8_t*) *dst);
- s.avail_out += space;
+ if (dst_max > 0 && space == dst_max)
+ return false;
- space *= 2;
+ used = space - s.avail_out;
+ space = MIN(2 * space, dst_max ?: (uint64_t) -1);
+ if (!greedy_realloc(dst, dst_alloc_size, space))
+ return false;
- *dst = p;
- *dst_alloc_size = space;
+ s.avail_out = space - used;
+ s.next_out = *dst + used;
}
*dst_size = space - s.avail_out;
- b = true;
-
-fail:
- lzma_end(&s);
-
- return b;
+ return true;
}
bool uncompress_startswith(const void *src, uint64_t src_size,
@@ -144,9 +130,8 @@ bool uncompress_startswith(const void *s
const void *prefix, uint64_t prefix_len,
uint8_t extra) {
- lzma_stream s = LZMA_STREAM_INIT;
+ _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
lzma_ret ret;
- bool b = false;
/* Checks whether the uncompressed blob starts with the
* mentioned prefix. The byte extra needs to follow the
@@ -163,16 +148,8 @@ bool uncompress_startswith(const void *s
if (ret != LZMA_OK)
return false;
- if (*buffer_size <= prefix_len) {
- void *p;
-
- p = realloc(*buffer, prefix_len*2);
- if (!p)
- return false;
-
- *buffer = p;
- *buffer_size = prefix_len*2;
- }
+ if (!(greedy_realloc(buffer, buffer_size, prefix_len + 1)))
+ return false;
s.next_in = src;
s.avail_in = src_size;
@@ -181,36 +158,23 @@ bool uncompress_startswith(const void *s
s.avail_out = *buffer_size;
for (;;) {
- void *p;
-
ret = lzma_code(&s, LZMA_FINISH);
if (ret != LZMA_STREAM_END && ret != LZMA_OK)
- goto fail;
+ return false;
- if ((*buffer_size - s.avail_out > prefix_len) &&
- memcmp(*buffer, prefix, prefix_len) == 0 &&
- ((const uint8_t*) *buffer)[prefix_len] == extra)
- break;
+ if (*buffer_size - s.avail_out >= prefix_len + 1)
+ return memcmp(*buffer, prefix, prefix_len) == 0 &&
+ ((const uint8_t*) *buffer)[prefix_len] == extra;
if (ret == LZMA_STREAM_END)
- goto fail;
-
- p = realloc(*buffer, *buffer_size*2);
- if (!p)
- goto fail;
+ return false;
- s.next_out = (uint8_t*) p + ((uint8_t*) s.next_out - (uint8_t*) *buffer);
s.avail_out += *buffer_size;
- *buffer = p;
- *buffer_size *= 2;
- }
-
- b = true;
-
-fail:
- lzma_end(&s);
+ if (!(greedy_realloc(buffer, buffer_size, *buffer_size * 2)))
+ return false;
- return b;
+ s.next_out = *buffer + *buffer_size - s.avail_out;
+ }
}

View File

@ -1,80 +0,0 @@
From 0ade5ffe2778e7b238bba8d979ca4d53dee1e702 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 31 Mar 2014 08:57:28 -0400
Subject: [PATCH] journal: fix export of messages containing newlines
In "export" format, newlines are significant, and messages containing
newlines must be exported as "binary".
---
src/shared/logs-show.c | 7 ++++---
src/shared/utf8.c | 5 +++--
src/shared/utf8.h | 5 ++++-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git src/shared/logs-show.c src/shared/logs-show.c
index 9d14933..b0b66f6 100644
--- src/shared/logs-show.c
+++ src/shared/logs-show.c
@@ -547,7 +547,9 @@ static int output_export(
startswith(data, "_BOOT_ID="))
continue;
- if (!utf8_is_printable(data, length)) {
+ if (utf8_is_printable_newline(data, length, false))
+ fwrite(data, length, 1, f);
+ else {
const char *c;
uint64_t le64;
@@ -562,8 +564,7 @@ static int output_export(
le64 = htole64(length - (c - (const char*) data) - 1);
fwrite(&le64, sizeof(le64), 1, f);
fwrite(c + 1, length - (c - (const char*) data) - 1, 1, f);
- } else
- fwrite(data, length, 1, f);
+ }
fputc('\n', f);
}
diff --git src/shared/utf8.c src/shared/utf8.c
index 0b524d8..c559c13 100644
--- src/shared/utf8.c
+++ src/shared/utf8.c
@@ -136,7 +136,7 @@ int utf8_encoded_to_unichar(const char *str) {
return unichar;
}
-bool utf8_is_printable(const char* str, size_t length) {
+bool utf8_is_printable_newline(const char* str, size_t length, bool newline) {
const uint8_t *p;
assert(str);
@@ -145,7 +145,8 @@ bool utf8_is_printable(const char* str, size_t length) {
int encoded_len = utf8_encoded_valid_unichar((const char *)p);
int val = utf8_encoded_to_unichar((const char*)p);
- if (encoded_len < 0 || val < 0 || is_unicode_control(val))
+ if (encoded_len < 0 || val < 0 || is_unicode_control(val) ||
+ (!newline && val == '\n'))
return false;
length -= encoded_len;
diff --git src/shared/utf8.h src/shared/utf8.h
index c0eb73a..c087995 100644
--- src/shared/utf8.h
+++ src/shared/utf8.h
@@ -31,7 +31,10 @@ const char *utf8_is_valid(const char *s) _pure_;
char *ascii_is_valid(const char *s) _pure_;
char *utf8_escape_invalid(const char *s);
-bool utf8_is_printable(const char* str, size_t length) _pure_;
+bool utf8_is_printable_newline(const char* str, size_t length, bool newline) _pure_;
+_pure_ static inline bool utf8_is_printable(const char* str, size_t length) {
+ return utf8_is_printable_newline(str, length, true);
+}
char *utf16_to_utf8(const void *s, size_t length);
--
1.7.9.2

View File

@ -1,27 +0,0 @@
From 4bed248505da4da94d82078fe60326a374970e97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 26 Sep 2014 10:49:55 -0400
Subject: [PATCH] journalctl: do not output --reboot-- markers when running
non-interactively
They are not legal in the export format.
---
src/journal/journalctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/journal/journalctl.c src/journal/journalctl.c
index 47206d3..89a922c 100644
--- src/journal/journalctl.c
+++ src/journal/journalctl.c
@@ -1939,7 +1939,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
- if (!arg_merge) {
+ if (!arg_merge && !arg_quiet) {
sd_id128_t boot_id;
r = sd_journal_get_monotonic_usec(j, NULL, &boot_id);
--
1.7.9.2

View File

@ -1,36 +0,0 @@
From d258d4967eb24122c2b1014d4e873f61b633f1d2 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Sun, 25 May 2014 11:57:22 +0200
Subject: [PATCH] keymap: Add Lenovo Enhanced USB Keyboard
https://bugs.freedesktop.org/show_bug.cgi?id=77234
---
hwdb/60-keyboard.hwdb | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb
index 832c686..fe5b3ee 100644
--- hwdb/60-keyboard.hwdb
+++ hwdb/60-keyboard.hwdb
@@ -579,6 +579,18 @@ keyboard:dmi:bvn*:bvr*:svnLENOVO*:pn*IdeaPad*Z370*:pvr*
keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*Lenovo*V480*:pvr*
KEYBOARD_KEY_f1=f21
+# enhanced USB keyboard
+keyboard:usb:v04B3p301B*
+ KEYBOARD_KEY_90001=prog1 # ThinkVantage
+ KEYBOARD_KEY_90002=screenlock
+ KEYBOARD_KEY_90003=file
+ KEYBOARD_KEY_90004=wordprocessor
+ KEYBOARD_KEY_90005=spreadsheet
+ KEYBOARD_KEY_90006=calc
+ KEYBOARD_KEY_90007=mail
+ KEYBOARD_KEY_90008=www
+
+
###########################################################
# Logitech
###########################################################
--
1.7.9.2

View File

@ -1,38 +0,0 @@
From 71ed2d38711e345f22e2200bc7bb156aed98972a Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 12 Nov 2014 23:30:46 +0100
Subject: [PATCH] keymap: Add support for IBM ThinkPad X41 Tablet
Scancode taken from:
http://www.thinkwiki.org/wiki/Tablet_Hardware_Buttons#Linux_Support
William Jon McCann provided the DMI match. IBM seems to have
swapped the version and model of the system:
Manufacturer: IBM
Product Name: 18666TU
Version: ThinkPad X41 Tablet
---
hwdb/60-keyboard.hwdb | 7 +++++++
1 file changed, 7 insertions(+)
diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb
index d2ca965..56a4009 100644
--- hwdb/60-keyboard.hwdb
+++ hwdb/60-keyboard.hwdb
@@ -594,6 +594,13 @@ keyboard:dmi:bvn*:bvr*:bd*:svnLENOVO*:pnThinkPad*X6*:pvr*
KEYBOARD_KEY_6f=down # down on d-pad
KEYBOARD_KEY_69=enter # enter on d-pad
+# ThinkPad X41 Tablet
+keyboard:dmi:bvn*:bvr*:bd*:svnIBM*:pn18666TU:pvr*
+ KEYBOARD_KEY_6c=direction # rotate
+ KEYBOARD_KEY_68=f13 # toolbox
+ KEYBOARD_KEY_6b=esc # escape
+ KEYBOARD_KEY_69=enter # enter on d-pad
+
# IdeaPad
keyboard:name:Ideapad extra buttons:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*
KEYBOARD_KEY_42=f23
--
1.7.9.2

View File

@ -1,27 +0,0 @@
From a046659f8551e1c8f79ba4b66472444e285255df Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Tue, 7 Oct 2014 11:20:04 +0200
Subject: [PATCH] keymap: Fix touchpad toggle on Toshiba Satellite P75-A7200
Just like everywhere else we use KEY_F21 instead of KEY_TOUCHPAD_TOGGLE for X
friendliness.
---
hwdb/60-keyboard.hwdb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb
index 8a1baa7..1fea32a 100644
--- hwdb/60-keyboard.hwdb
+++ hwdb/60-keyboard.hwdb
@@ -1094,7 +1094,7 @@ keyboard:name:Toshiba*input*device:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSatellite*P75
KEYBOARD_KEY_13c=brightnessdown
KEYBOARD_KEY_13d=brightnessup
KEYBOARD_KEY_13e=switchvideomode
- KEYBOARD_KEY_13f=touchpad_toggle
+ KEYBOARD_KEY_13f=f21 # Touchpad toggle
KEYBOARD_KEY_9e=wlan
###########################################################
--
1.7.9.2

View File

@ -1,5 +1,5 @@
--- systemd-210/shell-completion/bash/systemctl
+++ systemd-210/shell-completion/bash/systemctl 2014-08-20 15:01:04.502736981 +0000
--- systemd-210/shell-completion/bash/systemctl.in
+++ systemd-210/shell-completion/bash/systemctl.in 2014-08-20 15:01:04.502736981 +0000
@@ -43,7 +43,7 @@ __filter_units_by_property () {
local units=("$@")
local props

View File

@ -1,36 +0,0 @@
From 60240797a4ce464ec7a0537ccbec4c83f599251c Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Fri, 22 Aug 2014 14:57:11 +0200
Subject: [PATCH] login: fix memory-leak on DropController()
Our bus-name watch helpers only remove a bus-name if it's not a
controller, anymore. If we call manager_drop_busname() before
unregistering the controller, the busname will not be dropped. Therefore,
first drop the controller, then drop the bus-name.
---
src/login/logind-session.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git src/login/logind-session.c src/login/logind-session.c
index 136bbce..0c6e425 100644
--- src/login/logind-session.c
+++ src/login/logind-session.c
@@ -1061,11 +1061,13 @@ bool session_is_controller(Session *s, const char *sender) {
static void session_swap_controller(Session *s, char *name) {
SessionDevice *sd;
+ char *c;
if (s->controller) {
- manager_drop_busname(s->manager, s->controller);
- free(s->controller);
+ c = s->controller;
s->controller = NULL;
+ manager_drop_busname(s->manager, c);
+ free(c);
/* Drop all devices as they're now unused. Do that after the
* controller is released to avoid sending out useles
--
1.7.9.2

View File

@ -1,52 +0,0 @@
From a1937e679f76758635d295287398abe526de2522 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Tue, 25 Feb 2014 12:20:25 +0100
Subject: [PATCH] login: fix pos-array allocation
GREEDY_REALLOC takes a pointer to the real size, not the array-width as
argument. Therefore, our array is currently way to small to keep the seat
positions.
Introduce GREEDY_REALLOC0_T() as typed version of GREEDY_REALLOC and store
the array-width instead of array-size.
---
src/login/logind-seat.c | 2 +-
src/shared/util.h | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git src/login/logind-seat.c src/login/logind-seat.c
index 631be5f..36ec7ed 100644
--- src/login/logind-seat.c
+++ src/login/logind-seat.c
@@ -475,7 +475,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
if (seat_has_vts(s))
pos = session->vtnr;
- if (!GREEDY_REALLOC0(s->positions, s->position_count, pos + 1))
+ if (!GREEDY_REALLOC0_T(s->positions, s->position_count, pos + 1))
return;
seat_evict_position(s, session);
diff --git src/shared/util.h src/shared/util.h
index 9913fce..78b1444 100644
--- src/shared/util.h
+++ src/shared/util.h
@@ -723,6 +723,15 @@ void* greedy_realloc0(void **p, size_t *allocated, size_t need);
#define GREEDY_REALLOC0(array, allocated, need) \
greedy_realloc0((void**) &(array), &(allocated), sizeof((array)[0]) * (need))
+#define GREEDY_REALLOC0_T(array, count, need) \
+ ({ \
+ size_t _size = (count) * sizeof((array)[0]); \
+ void *_ptr = GREEDY_REALLOC0((array), _size, (need)); \
+ if (_ptr) \
+ (count) = _size / sizeof((array)[0]); \
+ _ptr; \
+ })
+
static inline void _reset_errno_(int *saved_errno) {
errno = *saved_errno;
}
--
1.7.9.2

View File

@ -1,82 +0,0 @@
Based on 2ec3ff668ff03410e94cfef8e3ee9384a8222211 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Fri, 19 Sep 2014 13:26:39 +0200
Subject: [PATCH] login: pause devices before acknowledging VT switches
If a session controller does not need synchronous VT switches, we allow
them to pass VT control to logind, which acknowledges all VT switches
unconditionally. This works fine with all sessions using the dbus API,
but causes out-of-sync device use if we switch to legacy sessions that
are notified via VT signals. Those are processed before logind notices
the session-switch via sysfs. Therefore, leaving the old session still
active for a short amount of time.
This, in fact, may cause the legacy session to prepare graphics devices
before the old session was deactivated, and thus, maybe causing the old
session to interfer with graphics device usage.
Fix this by releasing devices immediately before acknowledging VT
switches. This way, sessions without VT handlers are required to support
async session switching (which they do in that case, anyway).
---
src/login/logind-session.c | 21 +++++++++++++++++++++
src/login/logind-session.h | 1 +
src/login/logind.c | 4 ++--
3 files changed, 24 insertions(+), 2 deletions(-)
--- src/login/logind-session.c
+++ src/login/logind-session.c 2014-09-24 07:40:45.786639180 +0000
@@ -1040,6 +1040,27 @@ void session_restore_vt(Session *s) {
s->vtfd = -1;
}
+void session_leave_vt(Session *s) {
+ assert(s);
+
+ /* This is called whenever we get a VT-switch signal from the kernel.
+ * We acknowledge all of them unconditionally. Note that session are
+ * free to overwrite those handlers and we only register them for
+ * sessions with controllers. Legacy sessions are not affected.
+ * However, if we switch from a non-legacy to a legacy session, we must
+ * make sure to pause all device before acknowledging the switch. We
+ * process the real switch only after we are notified via sysfs, so the
+ * legacy session might have already started using the devices. If we
+ * don't pause the devices before the switch, we might confuse the
+ * session we switch to. */
+
+ if (s->vtfd < 0)
+ return;
+
+ session_device_pause_all(s);
+ ioctl(s->vtfd, VT_RELDISP, 1);
+}
+
bool session_is_controller(Session *s, const char *sender) {
assert(s);
--- src/login/logind-session.h
+++ src/login/logind-session.h 2014-09-24 07:41:50.290236363 +0000
@@ -173,6 +173,7 @@ KillWho kill_who_from_string(const char
int session_mute_vt(Session *s);
void session_restore_vt(Session *s);
+void session_leave_vt(Session *s);
bool session_is_controller(Session *s, const char *sender);
int session_set_controller(Session *s, const char *sender, bool force);
--- src/login/logind.c
+++ src/login/logind.c 2014-09-24 00:00:00.000000000 +0000
@@ -743,11 +743,11 @@ static int manager_vt_switch(sd_event_so
}
if (active->vtfd >= 0) {
- ioctl(active->vtfd, VT_RELDISP, 1);
+ session_leave_vt(active);
} else {
LIST_FOREACH(sessions_by_seat, iter, m->seat0->sessions) {
if (iter->vtnr == active->vtnr && iter->vtfd >= 0) {
- ioctl(iter->vtfd, VT_RELDISP, 1);
+ session_leave_vt(iter);
break;
}
}

View File

@ -1,60 +0,0 @@
From f6ba8671d83f9fce9a00045d8fa399a1c07ba7fc Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 5 Nov 2014 08:30:52 -0500
Subject: [PATCH] login: rerun vconsole-setup when switching from vgacon to
fbcon
The initialization performed by systemd-vconsole-setup is reset
when changing console drivers (say from vgacon to fbcon), so we
need to run it in that case.
See
http://lists.freedesktop.org/archives/systemd-devel/2014-October/023919.html
http://lists.freedesktop.org/archives/systemd-devel/2014-October/024423.html
http://lists.freedesktop.org/archives/systemd-devel/2014-November/024881.html
This commit adds a udev rule to make systemd-vconsole-setup get run when
the fbcon device becomes available.
(david: moved into new file 90-vconsole.rules instead of 71-seats.rules;
build-failures are on me, not on Ray)
---
Makefile.am | 3 +++
src/vconsole/90-vconsole.rules | 11 +++++++++++
2 files changed, 14 insertions(+)
create mode 100644 src/vconsole/90-vconsole.rules
diff --git Makefile.am Makefile.am
index 3686103..f614b86 100644
--- Makefile.am
+++ Makefile.am
@@ -4439,6 +4439,9 @@ rootlibexec_PROGRAMS += \
nodist_systemunit_DATA += \
units/systemd-vconsole-setup.service
+dist_udevrules_DATA += \
+ src/vconsole/90-vconsole.rules
+
SYSINIT_TARGET_WANTS += \
systemd-vconsole-setup.service
endif
diff --git src/vconsole/90-vconsole.rules src/vconsole/90-vconsole.rules
new file mode 100644
index 0000000..bf6a9ef
--- /dev/null
+++ src/vconsole/90-vconsole.rules
@@ -0,0 +1,11 @@
+# This file is part of systemd.
+#
+# 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.
+
+# Kernel resets vconsole state when changing console drivers so run
+# systemd-vconsole-setup when fbcon loads
+
+ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fbcon", RUN+="/usr/lib/systemd/systemd-vconsole-setup"
--
1.7.9.2

View File

@ -1,118 +0,0 @@
Based on b12e56156e5f363ebb8dc4ea5c10f5fd0665dc9d Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Mon, 1 Sep 2014 14:04:44 +0200
Subject: [PATCH] login: simplify controller handling
Simplify the way we handler session-controllers and fix several
shortcomings:
* send ReleaseDevice() signals on forced session takeover
* fix mem-leaks for busnames in case VT preparation fails (non-critical)
* avoid passing pre-allocated names to helpers
---
src/login/logind-session.c | 55 ++++++++++++++++++++++----------------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git src/login/logind-session.c src/login/logind-session.c
index 58453b5..10a43a4 100644
--- src/login/logind-session.c
+++ src/login/logind-session.c
@@ -1059,32 +1059,30 @@ bool session_is_controller(Session *s, const char *sender) {
return streq_ptr(s->controller, sender);
}
-static void session_swap_controller(Session *s, char *name) {
+static void session_release_controller(Session *s, bool notify) {
+ _cleanup_free_ char *name = NULL;
SessionDevice *sd;
- char *c;
- if (s->controller) {
- c = s->controller;
- s->controller = NULL;
- manager_drop_busname(s->manager, c);
- free(c);
+ if (!s->controller)
+ return;
- /* Drop all devices as they're now unused. Do that after the
- * controller is released to avoid sending out useles
- * dbus signals. */
- while ((sd = hashmap_first(s->devices)))
- session_device_free(sd);
+ name = s->controller;
- if (!name)
- session_restore_vt(s);
- }
+ /* By resetting the controller before releasing the devices, we won't
+ * send notification signals. This avoids sending useless notifications
+ * if the controller is released on disconnects. */
+ if (!notify)
+ s->controller = NULL;
- s->controller = name;
- session_save(s);
+ while ((sd = hashmap_first(s->devices)))
+ session_device_free(sd);
+
+ s->controller = NULL;
+ manager_drop_busname(s->manager, name);
}
int session_set_controller(Session *s, const char *sender, bool force) {
- char *t;
+ _cleanup_free_ char *name = NULL;
int r;
assert(s);
@@ -1095,15 +1093,13 @@ int session_set_controller(Session *s, const char *sender, bool force) {
if (s->controller && !force)
return -EBUSY;
- t = strdup(sender);
- if (!t)
+ name = strdup(sender);
+ if (!name)
return -ENOMEM;
- r = manager_watch_busname(s->manager, sender);
- if (r) {
- free(t);
+ r = manager_watch_busname(s->manager, name);
+ if (r)
return r;
- }
/* When setting a session controller, we forcibly mute the VT and set
* it into graphics-mode. Applications can override that by changing
@@ -1115,11 +1111,14 @@ int session_set_controller(Session *s, const char *sender, bool force) {
* or reset the VT in case it crashed/exited, too. */
r = session_mute_vt(s);
if (r < 0) {
- free(t);
+ manager_drop_busname(s->manager, name);
return r;
}
- session_swap_controller(s, t);
+ session_release_controller(s, true);
+ s->controller = name;
+ name = NULL;
+ session_save(s);
return 0;
}
@@ -1130,7 +1129,9 @@ void session_drop_controller(Session *s) {
if (!s->controller)
return;
- session_swap_controller(s, NULL);
+ session_release_controller(s, false);
+ session_save(s);
+ session_restore_vt(s);
}
static const char* const session_state_table[_SESSION_STATE_MAX] = {
--
1.7.9.2

View File

@ -1,24 +0,0 @@
From 58d4aabedd415a735efeb8c2608ee73618c07f78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 22 Sep 2014 22:14:39 -0400
Subject: [PATCH] logind: add support for Triton2 Power Button
https://bugs.freedesktop.org/show_bug.cgi?id=84201
---
src/login/70-power-switch.rules | 1 +
1 file changed, 1 insertion(+)
diff --git src/login/70-power-switch.rules src/login/70-power-switch.rules
index 36fb827..a6997f7 100644
--- src/login/70-power-switch.rules
+++ src/login/70-power-switch.rules
@@ -9,5 +9,6 @@ ACTION=="remove", GOTO="power_switch_end"
SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", TAG+="power-switch"
+SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="twl4030_pwrbutton", TAG+="power-switch"
LABEL="power_switch_end"
--
1.7.9.2

View File

@ -1,37 +0,0 @@
From 154034270c4643b7cfe61c0be1676d78bb1b7b07 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Tue, 8 Jul 2014 12:56:55 +0200
Subject: [PATCH] logind: allow switching to unused VTs via SwitchTo()
If compositors use the new SwitchTo() logic to map F1-F12, we should allow
them to switch to unregistered VTs, too. Otherwise, the auto-spawn logic
of gettys won't trigger.
Reported-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
src/login/logind-seat.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git src/login/logind-seat.c src/login/logind-seat.c
index 3114de8..9992195 100644
--- src/login/logind-seat.c
+++ src/login/logind-seat.c
@@ -275,8 +275,13 @@ int seat_switch_to(Seat *s, unsigned int num) {
if (!num)
return -EINVAL;
- if (num >= s->position_count || !s->positions[num])
+ if (num >= s->position_count || !s->positions[num]) {
+ /* allow switching to unused VTs to trigger auto-activate */
+ if (seat_has_vts(s) && num < 64)
+ return chvt(num);
+
return -EINVAL;
+ }
return session_activate(s->positions[num]);
}
--
1.7.9.2

View File

@ -1,168 +0,0 @@
From 6a79c58603ea816a1b4fa1520397b4e138bc1ca0 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 3 Mar 2014 19:30:16 +0100
Subject: [PATCH] logind: ignore lid switch if more than 1 display is
connected
Previously we expected the desktop environment to take an inhibitor
lock, but this opened a race on boot-up where logind might already be
running but no DE is active.
Hence, let's move checking for additional displays into logind. This
also opens up this logic for other DEs, given that only GNOME
implemented the inhibitor logic so far.
---
man/logind.conf.xml | 14 +++++++-----
src/login/logind-action.c | 8 +++++++
src/login/logind-core.c | 55 +++++++++++++++++++++++++++++++++++++++++++--
src/login/logind.h | 1 +
4 files changed, 71 insertions(+), 7 deletions(-)
diff --git man/logind.conf.xml man/logind.conf.xml
index 54cc379..7673201 100644
--- man/logind.conf.xml
+++ man/logind.conf.xml
@@ -242,10 +242,10 @@
<literal>ignore</literal>, logind will
never handle these keys. If
<literal>lock</literal>, all running
- sessions will be screen-locked; otherwise,
- the specified action
- will be taken in the respective
- event. Only input devices with the
+ sessions will be screen-locked;
+ otherwise, the specified action will
+ be taken in the respective event. Only
+ input devices with the
<literal>power-switch</literal> udev
tag will be watched for key/lid switch
events. <varname>HandlePowerKey=</varname>
@@ -257,7 +257,11 @@
default to <literal>suspend</literal>.
<varname>HandleHibernateKey=</varname>
defaults to
- <literal>hibernate</literal>.</para></listitem>
+ <literal>hibernate</literal>. Note
+ that the lid switch is ignored if the
+ system is inserted in a docking
+ station, or if more than one display
+ is connected.</para></listitem>
</varlistentry>
<varlistentry>
diff --git src/login/logind-action.c src/login/logind-action.c
index c04f210..da5a830 100644
--- src/login/logind-action.c
+++ src/login/logind-action.c
@@ -72,10 +72,18 @@ int manager_handle_action(
/* If we are docked don't react to lid closing */
if (inhibit_key == INHIBIT_HANDLE_LID_SWITCH) {
+ int n;
+
if (manager_is_docked(m)) {
log_debug("Ignoring lid switch request, system is docked.");
return 0;
}
+
+ n = manager_count_displays(m);
+ if (n != 1) {
+ log_debug("Ignoring lid switch request, %s displays connected.");
+ return 0;
+ }
}
/* If the key handling is inhibited, don't do anything */
diff --git src/login/logind-core.c src/login/logind-core.c
index e4e593f..b8d03c3 100644
--- src/login/logind-core.c
+++ src/login/logind-core.c
@@ -32,6 +32,7 @@
#include "audit.h"
#include "bus-util.h"
#include "bus-error.h"
+#include "udev-util.h"
#include "logind.h"
int manager_add_device(Manager *m, const char *sysfs, bool master, Device **_device) {
@@ -276,9 +277,11 @@ int manager_process_seat_device(Manager *m, struct udev_device *d) {
return 0;
}
- /* ignore non-master devices for unknown seats */
+ seat = hashmap_get(m->seats, sn);
master = udev_device_has_tag(d, "master-of-seat");
- if (!master && !(seat = hashmap_get(m->seats, sn)))
+
+ /* Ignore non-master devices for unknown seats */
+ if (!master && !seat)
return 0;
r = manager_add_device(m, udev_device_get_syspath(d), master, &device);
@@ -514,3 +517,51 @@ bool manager_is_docked(Manager *m) {
return false;
}
+
+int manager_count_displays(Manager *m) {
+ _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+ struct udev_list_entry *item = NULL, *first = NULL;
+ int r;
+ int n = 0;
+
+ e = udev_enumerate_new(m->udev);
+ if (!e)
+ return -ENOMEM;
+
+ r = udev_enumerate_add_match_subsystem(e, "drm");
+ if (r < 0)
+ return r;
+
+ r = udev_enumerate_scan_devices(e);
+ if (r < 0)
+ return r;
+
+ first = udev_enumerate_get_list_entry(e);
+ udev_list_entry_foreach(item, first) {
+ _cleanup_udev_device_unref_ struct udev_device *d = NULL;
+ struct udev_device *p;
+ const char *status;
+
+ d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item));
+ if (!d)
+ return -ENOMEM;
+
+ p = udev_device_get_parent(d);
+ if (!p)
+ return -ENOMEM;
+
+ /* If the parent shares the same subsystem as the
+ * device we are looking at then it is a connector,
+ * which is what we are interested in. */
+ if (!streq_ptr(udev_device_get_subsystem(p), "drm"))
+ continue;
+
+ /* We count any connector which is not explicitly
+ * "disconnected" as connected. */
+ status = udev_device_get_sysattr_value(d, "status");
+ if (!streq_ptr(status, "disconnected"))
+ n++;
+ }
+
+ return n;
+}
diff --git src/login/logind.h src/login/logind.h
index 0344acc..74d6641 100644
--- src/login/logind.h
+++ src/login/logind.h
@@ -149,6 +149,7 @@ int manager_get_user_by_pid(Manager *m, pid_t pid, User **user);
int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session);
bool manager_is_docked(Manager *m);
+int manager_count_displays(Manager *m);
extern const sd_bus_vtable manager_vtable[];
--
1.7.9.2

View File

@ -1,26 +0,0 @@
From f14aa1f1b2e4e99ee20393871b5f64f1378ed6c3 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Sun, 6 Jul 2014 14:12:28 +0200
Subject: [PATCH] machine: don't return uninitialized variable
Repotred by Ronny Chevalier
---
src/machine/machine.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/machine/machine.c src/machine/machine.c
index c0fa1b2..cf38e3f 100644
--- src/machine/machine.c
+++ src/machine/machine.c
@@ -371,7 +371,7 @@ static int machine_stop_scope(Machine *m) {
free(m->scope_job);
m->scope_job = job;
- return r;
+ return 0;
}
int machine_stop(Machine *m) {
--
1.7.9.2

View File

@ -1,26 +0,0 @@
Based on 1f97091d3cb0887c264176b47b0a86c269acf0b5 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 27 Jun 2014 18:34:37 +0200
Subject: [PATCH] main: uid_to_name() might fail due to OOM, protect against
that
---
src/core/main.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- src/core/main.c
+++ src/core/main.c 2014-07-01 12:25:17.906235000 +0000
@@ -1525,9 +1525,10 @@ int main(int argc, char *argv[]) {
log_info("Running in initial RAM disk.");
} else {
- _cleanup_free_ char *t = uid_to_name(getuid());
- log_debug(PACKAGE_STRING " running in user mode for user "UID_FMT"/%s. (" SYSTEMD_FEATURES ")",
- getuid(), t);
+ _cleanup_free_ char *t;
+
+ t = uid_to_name(getuid());
+ log_debug(PACKAGE_STRING " running in user mode for user "UID_FMT"/%s. (" SYSTEMD_FEATURES ")", getuid(), strna(t));
}
if (arg_running_as == SYSTEMD_SYSTEM && !skip_setup) {

View File

@ -1,79 +0,0 @@
--- systemd-209/units/kmod-static-nodes.service.in
+++ systemd-209/units/kmod-static-nodes.service.in 2014-02-27 15:04:30.378236539 +0000
@@ -15,4 +15,5 @@ ConditionPathExists=/lib/modules/%v/modu
[Service]
Type=oneshot
RemainAfterExit=yes
+ExecStartPre=@MKDIR_P@ /run/tmpfiles.d
ExecStart=@KMOD@ static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
--- systemd-209/configure.ac
+++ systemd-209/configure.ac 2014-02-28 17:14:14.866235643 +0000
@@ -300,9 +300,9 @@ AC_ARG_ENABLE(kmod, AS_HELP_STRING([--di
if test "x$enable_kmod" != "xno"; then
PKG_CHECK_EXISTS([ libkmod ], have_kmod=yes, have_kmod=no)
if test "x$have_kmod" = "xyes"; then
- PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ],
+ PKG_CHECK_MODULES(KMOD, [ libkmod >= 14 ],
[AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])],
- AC_MSG_ERROR([*** kmod version >= 15 not found]))
+ AC_MSG_ERROR([*** kmod version >= 14 not found]))
fi
if test "x$have_kmod" = xno -a "x$enable_kmod" = xyes; then
AC_MSG_ERROR([*** kmod support requested, but libraries not found])
--- systemd-209/configure
+++ systemd-209/configure 2014-02-28 17:13:50.770735397 +0000
@@ -15999,12 +15999,12 @@ if test -n "$KMOD_CFLAGS"; then
pkg_cv_KMOD_CFLAGS="$KMOD_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 15 \""; } >&5
- ($PKG_CONFIG --exists --print-errors " libkmod >= 15 ") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 14 \""; } >&5
+ ($PKG_CONFIG --exists --print-errors " libkmod >= 14 ") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_KMOD_CFLAGS=`$PKG_CONFIG --cflags " libkmod >= 15 " 2>/dev/null`
+ pkg_cv_KMOD_CFLAGS=`$PKG_CONFIG --cflags " libkmod >= 14 " 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -16016,12 +16016,12 @@ if test -n "$KMOD_LIBS"; then
pkg_cv_KMOD_LIBS="$KMOD_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 15 \""; } >&5
- ($PKG_CONFIG --exists --print-errors " libkmod >= 15 ") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 14 \""; } >&5
+ ($PKG_CONFIG --exists --print-errors " libkmod >= 14 ") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_KMOD_LIBS=`$PKG_CONFIG --libs " libkmod >= 15 " 2>/dev/null`
+ pkg_cv_KMOD_LIBS=`$PKG_CONFIG --libs " libkmod >= 14 " 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -16042,18 +16042,18 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- KMOD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " libkmod >= 15 " 2>&1`
+ KMOD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " libkmod >= 14 " 2>&1`
else
- KMOD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " libkmod >= 15 " 2>&1`
+ KMOD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " libkmod >= 14 " 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$KMOD_PKG_ERRORS" >&5
- as_fn_error $? "*** kmod version >= 15 not found" "$LINENO" 5
+ as_fn_error $? "*** kmod version >= 14 not found" "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- as_fn_error $? "*** kmod version >= 15 not found" "$LINENO" 5
+ as_fn_error $? "*** kmod version >= 14 not found" "$LINENO" 5
else
KMOD_CFLAGS=$pkg_cv_KMOD_CFLAGS
KMOD_LIBS=$pkg_cv_KMOD_LIBS

View File

@ -1,55 +0,0 @@
--- systemd-209/src/libsystemd/sd-bus/sd-bus.c
+++ systemd-209/src/libsystemd/sd-bus/sd-bus.c 2014-02-28 11:08:21.354235373 +0000
@@ -2548,7 +2548,7 @@ static int bus_poll(sd_bus *bus, bool ne
n = 2;
}
- r = ppoll(p, n, m == (uint64_t) -1 ? NULL : timespec_store(&ts, m), NULL);
+ r = __ppoll_alias(p, n, m == (uint64_t) -1 ? NULL : timespec_store(&ts, m), NULL);
if (r < 0)
return -errno;
--- systemd-209/src/core/hostname-setup.c
+++ systemd-209/src/core/hostname-setup.c 2014-02-28 11:14:51.594832792 +0000
@@ -50,8 +50,8 @@ static int read_and_strip_hostname(const
}
/* strip any leftover of a domain name */
- if (domain = strchr(s, '.')) {
- *domain = NULL;
+ if ((domain = strchr(s, '.'))) {
+ *domain = '\0';
}
*hn = s;
--- systemd-209/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ systemd-209/src/tty-ask-password-agent/tty-ask-password-agent.c 2014-02-28 11:41:42.254735820 +0000
@@ -142,7 +142,7 @@ static int ask_password_plymouth(
goto finish;
}
- if ((j = poll(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) {
+ if ((j = __poll_alias(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) {
if (errno == EINTR)
continue;
@@ -595,7 +595,7 @@ static int watch_passwords(void) {
if ((r = show_passwords()) < 0)
log_error("Failed to show password: %s", strerror(-r));
- if (poll(pollfd, _FD_MAX, -1) < 0) {
+ if (__poll_alias(pollfd, _FD_MAX, -1) < 0) {
if (errno == EINTR)
continue;
--- systemd-209/src/shared/ask-password-api.c
+++ systemd-209/src/shared/ask-password-api.c 2014-02-28 11:47:21.754234675 +0000
@@ -138,7 +138,7 @@ int ask_password_tty(
goto finish;
}
- if ((k = poll(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) {
+ if ((k = __poll_alias(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) {
if (errno == EINTR)
continue;

View File

@ -1,79 +0,0 @@
Based on 4dffec1459f50ac9f8f67ccfcb79836b4ed5a50e Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 24 Oct 2014 13:44:45 +0200
Subject: [PATCH] manager: Linux on hppa has fewer rtsigs, hence avoid using
the higher ones there
https://bugs.freedesktop.org/show_bug.cgi?id=84931
---
src/core/manager.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
--- src/core/manager.c
+++ src/core/manager.c 2014-10-29 14:02:28.635837997 +0000
@@ -340,11 +340,14 @@ static int manager_setup_signals(Manager
assert(m);
- /* We are not interested in SIGSTOP and friends. */
assert_se(sigaction(SIGCHLD, &sa, NULL) == 0);
- assert_se(sigemptyset(&mask) == 0);
+ /* We make liberal use of realtime signals here. On
+ * Linux/glibc we have 30 of them (with the exception of Linux
+ * on hppa, see below), between SIGRTMIN+0 ... SIGRTMIN+30
+ * (aka SIGRTMAX). */
+ assert_se(sigemptyset(&mask) == 0);
sigset_add_many(&mask,
SIGCHLD, /* Child died */
SIGTERM, /* Reexecute daemon */
@@ -354,6 +357,7 @@ static int manager_setup_signals(Manager
SIGINT, /* Kernel sends us this on control-alt-del */
SIGWINCH, /* Kernel sends us this on kbrequest (alt-arrowup) */
SIGPWR, /* Some kernel drivers and upsd send us this on power failure */
+
SIGRTMIN+0, /* systemd: start default.target */
SIGRTMIN+1, /* systemd: isolate rescue.target */
SIGRTMIN+2, /* systemd: isolate emergency.target */
@@ -361,19 +365,40 @@ static int manager_setup_signals(Manager
SIGRTMIN+4, /* systemd: start poweroff.target */
SIGRTMIN+5, /* systemd: start reboot.target */
SIGRTMIN+6, /* systemd: start kexec.target */
+
+ /* ... space for more special targets ... */
+
SIGRTMIN+13, /* systemd: Immediate halt */
SIGRTMIN+14, /* systemd: Immediate poweroff */
SIGRTMIN+15, /* systemd: Immediate reboot */
SIGRTMIN+16, /* systemd: Immediate kexec */
+
+ /* ... space for more immediate system state changes ... */
+
SIGRTMIN+20, /* systemd: enable status messages */
SIGRTMIN+21, /* systemd: disable status messages */
SIGRTMIN+22, /* systemd: set log level to LOG_DEBUG */
SIGRTMIN+23, /* systemd: set log level to LOG_INFO */
SIGRTMIN+24, /* systemd: Immediate exit (--user only) */
+
+ /* .. one free signal here ... */
+
+#if !defined(__hppa64__) && !defined(__hppa__)
+ /* Apparently Linux on hppa has fewer RT
+ * signals (SIGRTMAX is SIGRTMIN+25 there),
+ * hence let's not try to make use of them
+ * here. Since these commands are accessible
+ * by different means and only really a safety
+ * net, the missing functionality on hppa
+ * shouldn't matter. */
+
SIGRTMIN+26, /* systemd: set log target to journal-or-kmsg */
SIGRTMIN+27, /* systemd: set log target to console */
SIGRTMIN+28, /* systemd: set log target to kmsg */
SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg */
+
+ /* ... one free signal here SIGRTMIN+30 ... */
+#endif
-1);
assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);

View File

@ -1,45 +0,0 @@
From e6a4a517befe559adf6d1dbbadf425c3538849c9 Mon Sep 17 00:00:00 2001
From: Djalal Harouni <tixxdz@opendz.org>
Date: Fri, 11 Apr 2014 01:45:52 +0100
Subject: [PATCH] nspawn: allow to bind mount journal on top of a non empty
container journal dentry
Currently if nspawn was called with --link-journal=host or
--link-journal=auto and the right /var/log/journal/machine-id/ exists
then the bind mount the subdirectory into the container might fail due
to the ~/mycontainer/var/log/journal/machine-id/ of the container not
being empty.
There is no reason to check if the container journal subdir is empty
since there will be a bind mount on top of it. The user asked for a bind
mount so give it.
Note: a next call with --link-journal=guest may fail due to the
/var/log/journal/machine-id/ on the host not being empty.
https://bugs.freedesktop.org/show_bug.cgi?id=76193
Reported-by: Tobias Hunger <tobias.hunger@gmail.com>
---
src/nspawn/nspawn.c | 5 -----
1 file changed, 5 deletions(-)
diff --git src/nspawn/nspawn.c src/nspawn/nspawn.c
index 9d9238f..ef84664 100644
--- src/nspawn/nspawn.c
+++ src/nspawn/nspawn.c
@@ -1143,11 +1143,6 @@ static int setup_journal(const char *directory) {
} else if (access(p, F_OK) < 0)
return 0;
- if (dir_is_empty(q) == 0) {
- log_error("%s not empty.", q);
- return -ENOTEMPTY;
- }
-
r = mkdir_p(q, 0755);
if (r < 0) {
log_error("Failed to create %s: %m", q);
--
1.7.9.2

View File

@ -1,21 +0,0 @@
Based on c00524c9cc7fb498c7244350e25823b8352f078c Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Fri, 19 Sep 2014 23:02:00 +0200
Subject: [PATCH] nspawn: don't try to create veth link with too long ifname
Reported by: James Lott <james@lottspot.com>
---
src/nspawn/nspawn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- src/nspawn/nspawn.c
+++ src/nspawn/nspawn.c 2014-09-23 15:33:06.766236272 +0000
@@ -1383,7 +1383,7 @@ static int setup_veth(pid_t pid, char if
/* Use two different interface name prefixes depending whether
* we are in bridge mode or not. */
- snprintf(iface_name, IFNAMSIZ, "%s-%s",
+ snprintf(iface_name, IFNAMSIZ - 1, "%s-%s",
arg_network_bridge ? "vb" : "ve", arg_machine);
r = sd_rtnl_open(&rtnl, 0);

View File

@ -1,21 +0,0 @@
Based on 3125b3ef5db70d45882c7d6f617705802c5f939e Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Thu, 28 Aug 2014 12:15:51 +0200
Subject: [PATCH] nspawn: fix --network-interface
Use SETLINK when modifying an existing link.
---
src/nspawn/nspawn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- src/nspawn/nspawn.c
+++ src/nspawn/nspawn.c 2014-08-29 14:11:25.866235309 +0000
@@ -1568,7 +1568,7 @@ static int move_network_interfaces(pid_t
return -EBUSY;
}
- r = sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, ifi);
+ r = sd_rtnl_message_new_link(rtnl, &m, RTM_SETLINK, ifi);
if (r < 0) {
log_error("Failed to allocate netlink message: %s", strerror(-r));
return r;

View File

@ -1,31 +0,0 @@
Based on 4212a3375e03fd12cb407b34cab59dbe4ed9f4eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 3 Aug 2014 01:28:21 -0400
Subject: [PATCH] nspawn: fix truncation of machine names in interface names
Based on patch by Michael Marineau <michael.marineau@coreos.com>:
When deriving the network interface name from machine name strncpy was
not properly null terminating the string and the maximum string size as
returned by strlen() is actually IFNAMSIZ-1, not IFNAMSIZ.
---
src/nspawn/nspawn.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
--- src/nspawn/nspawn.c
+++ src/nspawn/nspawn.c 2014-08-22 10:18:20.390235611 +0000
@@ -1383,12 +1383,8 @@ static int setup_veth(pid_t pid, char if
/* Use two different interface name prefixes depending whether
* we are in bridge mode or not. */
- if (arg_network_bridge)
- memcpy(iface_name, "vb-", 3);
- else
- memcpy(iface_name, "ve-", 3);
-
- strncpy(iface_name+3, arg_machine, IFNAMSIZ - 3);
+ snprintf(iface_name, IFNAMSIZ, "%s-%s",
+ arg_network_bridge ? "vb" : "ve", arg_machine);
r = sd_rtnl_open(&rtnl, 0);
if (r < 0) {

View File

@ -8,11 +8,11 @@ is used, the XDG_RUNTIME_DIR will not be clobbered by the new uid.
This belongs to BNC#852015 and also to BNC#855160
---
pam-module.c | 19 +++++++++++++++++++
pam_systemd.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
--- systemd-209/src/login/pam-module.c
+++ systemd-209/src/login/pam-module.c 2014-02-26 14:31:30.158235525 +0000
--- systemd-209/src/login/pam_systemd.c
+++ systemd-209/src/login/pam_systemd.c 2014-02-26 14:31:30.158235525 +0000
@@ -447,6 +447,25 @@ _public_ PAM_EXTERN int pam_sm_open_sess
r = export_legacy_dbus_address(handle, pw->pw_uid, runtime_path);
if (r != PAM_SUCCESS)

View File

@ -1,45 +0,0 @@
From f841a154efbb3162d2a732936f031ac7a6b0d4cf Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Tue, 1 Jul 2014 16:00:05 +0200
Subject: [PATCH] parse_uid: return -ENXIO for -1 uids
---
src/shared/audit.c | 3 ---
src/shared/util.c | 4 ++--
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git src/shared/audit.c src/shared/audit.c
index 5466447..f101050 100644
--- src/shared/audit.c
+++ src/shared/audit.c
@@ -77,9 +77,6 @@ int audit_loginuid_from_pid(pid_t pid, uid_t *uid) {
if (r < 0)
return r;
- if (u == (uid_t) -1)
- return -ENXIO;
-
*uid = (uid_t) u;
return 0;
}
diff --git src/shared/util.c src/shared/util.c
index e75f6c9..9b5a47a 100644
--- src/shared/util.c
+++ src/shared/util.c
@@ -282,11 +282,11 @@ int parse_uid(const char *s, uid_t* ret_uid) {
/* Some libc APIs use (uid_t) -1 as special placeholder */
if (uid == (uid_t) 0xFFFFFFFF)
- return -EINVAL;
+ return -ENXIO;
/* A long time ago UIDs where 16bit, hence explicitly avoid the 16bit -1 too */
if (uid == (uid_t) 0xFFFF)
- return -EINVAL;
+ return -ENXIO;
*ret_uid = uid;
return 0;
--
1.7.9.2

View File

@ -1,406 +0,0 @@
From 260b6323cc2aebe722d5b8e43fa63a502f906774 Mon Sep 17 00:00:00 2001
From: Daniel Korostil <ted.korostiled@gmail.com>
Date: Thu, 17 Jul 2014 02:07:29 +0300
Subject: [PATCH] po: add Ukrainian translation
---
po/LINGUAS | 1 +
po/uk.po | 377 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 378 insertions(+)
create mode 100644 po/uk.po
diff --git po/LINGUAS po/LINGUAS
index 2cb0f30..f214ece 100644
--- po/LINGUAS
+++ po/LINGUAS
@@ -4,3 +4,4 @@ fr
it
pl
ru
+uk
diff --git po/uk.po po/uk.po
new file mode 100644
index 0000000..7a5212a
--- /dev/null
+++ po/uk.po
@@ -0,0 +1,377 @@
+# Ukrainian translation for systemd.
+# Copyright (C) 2014 systemd's COPYRIGHT HOLDER
+# This file is distributed under the same license as the systemd package.
+# Eugene Melnik <jeka7js@gmail.com>, 2014.
+# Daniel Korostil <ted.korostiled@gmail.com>, 2014.
+msgid ""
+msgstr ""
+"Project-Id-Version: systemd master\n"
+"Report-Msgid-Bugs-To: https://bugs.freedesktop.org/enter_bug.cgi?product=sys"
+"temd&keywords=I18N+L10N&component=general\n"
+"POT-Creation-Date: 2014-06-06 22:16+0000\n"
+"PO-Revision-Date: 2014-07-16 19:13+0300\n"
+"Last-Translator: Daniel Korostil <ted.korostiled@gmail.com>\n"
+"Language-Team: linux.org.ua\n"
+"Language: uk\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
+"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+"X-Generator: Virtaal 0.7.1\n"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1
+msgid "Set host name"
+msgstr "Встановити назву вузла"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2
+msgid "Authentication is required to set the local host name."
+msgstr "Засвідчення потрібне, щоб встановити назву локального вузла."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3
+msgid "Set static host name"
+msgstr "Встановити статичну назву вузла"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4
+msgid ""
+"Authentication is required to set the statically configured local host name, "
+"as well as the pretty host name."
+msgstr ""
+"Засвідчення потрібне, щоб вказати статично налаштовану назву локального "
+"вузла, так само й форматовану."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5
+msgid "Set machine information"
+msgstr "Встановити інформацію про машину"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6
+msgid "Authentication is required to set local machine information."
+msgstr "Засвідчення потрібно, щоб вказати локальну інформацію про машини."
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:1
+msgid "Set system locale"
+msgstr "Вказати системну локаль"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:2
+msgid "Authentication is required to set the system locale."
+msgstr "Засвідчення потрібно, щоб встановити системну локаль."
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:3
+msgid "Set system keyboard settings"
+msgstr "Вказати налаштування системної клавіатури"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:4
+msgid "Authentication is required to set the system keyboard settings."
+msgstr "Засвідчення потрібно, щоб вказати налаштування системної клавіатури."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:1
+msgid "Allow applications to inhibit system shutdown"
+msgstr "Дозволити програмам перешкоджати вимкненню системи"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:2
+msgid ""
+"Authentication is required to allow an application to inhibit system "
+"shutdown."
+msgstr ""
+"Засвідчення потрібно, щоб дозволити програмам перешкоджати вимкненню системи."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:3
+msgid "Allow applications to delay system shutdown"
+msgstr "Дозволити програмам затримувати вимкнення системи"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:4
+msgid ""
+"Authentication is required to allow an application to delay system shutdown."
+msgstr ""
+"Засвідчення потрібно, щоб дозволити програмам затримувати вимкнення системи."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:5
+msgid "Allow applications to inhibit system sleep"
+msgstr "Дозволити програмам перешкоджати засинанню системи"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:6
+msgid ""
+"Authentication is required to allow an application to inhibit system sleep."
+msgstr ""
+"Засвідчення потрібно, щоб дозволити програмам перешкоджати засинанню системи."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:7
+msgid "Allow applications to delay system sleep"
+msgstr "Дозволити програмами затримувати засинання системи"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:8
+msgid ""
+"Authentication is required to allow an application to delay system sleep."
+msgstr ""
+"Засвідчення потрібно, щоб дозволити програмам затримувати засинання системи."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:9
+msgid "Allow applications to inhibit automatic system suspend"
+msgstr "Дозволити програмам перешкоджати автоматичному призупиненню системи"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:10
+msgid ""
+"Authentication is required to allow an application to inhibit automatic "
+"system suspend."
+msgstr ""
+"Засвідчення потрібно, щоб дозволити програмам перешкоджати автоматичному "
+"призупиненню системи."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:11
+msgid "Allow applications to inhibit system handling of the power key"
+msgstr "Дозволити програмам перешкоджати обробленню системою клавіші живлення"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:12
+msgid ""
+"Authentication is required to allow an application to inhibit system "
+"handling of the power key."
+msgstr ""
+"Засвідчення потрібно, щоб дозволити програмам перешкоджати обробленню "
+"системою клавіші живлення."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:13
+msgid "Allow applications to inhibit system handling of the suspend key"
+msgstr ""
+"Дозволити програмам перешкоджати обробленню системою клавіші призупинення"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:14
+msgid ""
+"Authentication is required to allow an application to inhibit system "
+"handling of the suspend key."
+msgstr ""
+"Засвідчення потрібно, щоб дозволити програмам перешкоджати обробленню "
+"системою клавіші призупинення."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:15
+msgid "Allow applications to inhibit system handling of the hibernate key"
+msgstr "Дозволити програмам перешкоджати обробленню системою клавіші присипання"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:16
+msgid ""
+"Authentication is required to allow an application to inhibit system "
+"handling of the hibernate key."
+msgstr ""
+"Засвідчення потрібно, щоб дозволити програмам перешкоджати обробленню "
+"системою клавіші присипання."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:17
+msgid "Allow applications to inhibit system handling of the lid switch"
+msgstr ""
+"Дозволити програмам перешкоджати обробленню системою клавіші перемикання "
+"кришки"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:18
+msgid ""
+"Authentication is required to allow an application to inhibit system "
+"handling of the lid switch."
+msgstr ""
+"Засвідчення потрібно, щоб дозволити програмам перешкоджати обробленню "
+"системою клавіші перемикання кришки."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:19
+msgid "Allow non-logged-in users to run programs"
+msgstr "Дозволити незареєстрованим користувачам запускати програми"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:20
+msgid ""
+"Authentication is required to allow a non-logged-in user to run programs."
+msgstr ""
+"Засвідчення потрібно, щоб дозволити незареєстрованим користувачам запускати "
+"програми."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:21
+msgid "Allow attaching devices to seats"
+msgstr "Дозволити під'єднання пристроїв до місць"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:22
+msgid "Authentication is required for attaching a device to a seat."
+msgstr "Засвідчення потрібно, щоб під'єднувати пристрої до місць."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:23
+msgid "Flush device to seat attachments"
+msgstr "Очисний пристрій для під'єднань до місця"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:24
+msgid ""
+"Authentication is required for resetting how devices are attached to seats."
+msgstr "Засвідчення потрібно, щоб перезапустити спосіб під'єднання до місць."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:25
+msgid "Power off the system"
+msgstr "Вимкнути систему"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:26
+msgid "Authentication is required for powering off the system."
+msgstr "Засвідчення потрібно, щоб вимкнути систему."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:27
+msgid "Power off the system while other users are logged in"
+msgstr "Вимикнути систему, коли інші користувачі ще в ній"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:28
+msgid ""
+"Authentication is required for powering off the system while other users are "
+"logged in."
+msgstr ""
+"Засвідчення потрібно, щоб вимкнути систему, коли інші користувачі в ній."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:29
+msgid "Power off the system while an application asked to inhibit it"
+msgstr "Вимкнути систему, коли програми намагаються першкодити цьому"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:30
+msgid ""
+"Authentication is required for powering off the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Засвідчення потрібно, щоб вимкнути систему, коли програми намагаються "
+"першкодити цьому."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:31
+msgid "Reboot the system"
+msgstr "Перезавантажити систему"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:32
+msgid "Authentication is required for rebooting the system."
+msgstr "Для перезавантаження системи необхідна ідентифікація."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:33
+msgid "Reboot the system while other users are logged in"
+msgstr "Перезавантажити, якщо інщі користувачі в системі"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:34
+msgid ""
+"Authentication is required for rebooting the system while other users are "
+"logged in."
+msgstr ""
+"Засвідчення потрібно, щоб перезапустити систему, коли інші користувачі в "
+"ній."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:35
+msgid "Reboot the system while an application asked to inhibit it"
+msgstr "Перезапустити систему, коли програми намагаються першкодити цьому"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:36
+msgid ""
+"Authentication is required for rebooting the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Засвідчення потрібно, щоб перезапустити систему, коли програми намагаються "
+"першкодити цьому."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:37
+msgid "Suspend the system"
+msgstr "Призупинити систему"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:38
+msgid "Authentication is required for suspending the system."
+msgstr "Засвідчення потрібно, щоб призупинити систему."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:39
+msgid "Suspend the system while other users are logged in"
+msgstr "Призупинити систему, коли інші користувачі в ній"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:40
+msgid ""
+"Authentication is required for suspending the system while other users are "
+"logged in."
+msgstr ""
+"Засвідчення потрібно, щоб призупинити систему, коли інші користувачі в ній."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:41
+msgid "Suspend the system while an application asked to inhibit it"
+msgstr "Призупинити систему, коли програми намагаються першкодити цьому"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:42
+msgid ""
+"Authentication is required for suspending the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Засвідчення потрібно, щоб призупнити систему, коли програми намагаються "
+"першкодити цьому."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:43
+msgid "Hibernate the system"
+msgstr "Приспати систему"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:44
+msgid "Authentication is required for hibernating the system."
+msgstr "Засвідчення потрібно, щоб приспати систему."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:45
+msgid "Hibernate the system while other users are logged in"
+msgstr "Приспати систему, коли інші користувачі в ній"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:46
+msgid ""
+"Authentication is required for hibernating the system while other users are "
+"logged in."
+msgstr ""
+"Засвідчення потрібно, щоб присипання систему, коли інші користувачі в ній."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:47
+msgid "Hibernate the system while an application asked to inhibit it"
+msgstr "Приспати систему, коли програми намагаються першкодити цьому"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:48
+msgid ""
+"Authentication is required for hibernating the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Засвідчення потрібно, щоб приспати систему, коли програми намагаються "
+"першкодити цьому."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1
+msgid "Set system time"
+msgstr "Вказати системний час"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2
+msgid "Authentication is required to set the system time."
+msgstr "Засвідчення потрібно, щоб вказати системний час."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3
+msgid "Set system timezone"
+msgstr "Вказати системний часовий пояс"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4
+msgid "Authentication is required to set the system timezone."
+msgstr "Засвідчення потрібно, щоб вказати системний часовий пояс."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5
+msgid "Set RTC to local timezone or UTC"
+msgstr "Вкажіть RTC для локального часового поясу або UTC"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6
+msgid ""
+"Authentication is required to control whether the RTC stores the local or "
+"UTC time."
+msgstr "Засвідчення потрібно, щоб контролювати, чи RTC зберігає час, чи UTC."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7
+msgid "Turn network time synchronization on or off"
+msgstr "Увімкнути або вимкнути синхронізування через мережу"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8
+msgid ""
+"Authentication is required to control whether network time synchronization "
+"shall be enabled."
+msgstr ""
+"Засвідчення потрібно, щоб контролювати, чи синхронізування часу через мережу "
+"запущено."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
+msgid "Send passphrase back to system"
+msgstr "Надіслати пароль назад у систему"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2
+msgid ""
+"Authentication is required to send the entered passphrase back to the system."
+msgstr "Засвідчення потрібно, щоб надіслати введений пароль назад у систему."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3
+msgid "Privileged system and service manager access"
+msgstr "Привілейований доступ до менеджера системи і служб"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4
+msgid "Authentication is required to access the system and service manager."
+msgstr "Засвідчення потрібно, щоб доступитись до менеджера системи і служб."
--
1.7.9.2

View File

@ -1,27 +0,0 @@
Based on b2103dccb354de3f38c49c14ccb637bdf665e40f Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Sat, 5 Apr 2014 13:59:01 -0400
Subject: [PATCH] reduce the amount of messages logged to /dev/kmsg when
"debug" is specified
---
src/core/main.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
--- src/core/main.c
+++ src/core/main.c 2014-04-14 13:50:48.490814738 +0000
@@ -412,12 +412,8 @@ static int parse_proc_cmdline_word(const
if (arg_show_status == _SHOW_STATUS_UNSET)
arg_show_status = SHOW_STATUS_AUTO;
} else if (streq(word, "debug")) {
- /* Log to kmsg, the journal socket will fill up before the
- * journal is started and tools running during that time
- * will block with every log message for for 60 seconds,
- * before they give up. */
- log_set_max_level(LOG_DEBUG);
- log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_KMSG);
+ if (detect_container(NULL) > 0)
+ log_set_target(LOG_TARGET_CONSOLE);
} else if (!in_initrd()) {
unsigned i;

View File

@ -1,39 +0,0 @@
From ead349509e325aad720bb0349521a9e56e2ac7c0 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 13 May 2014 16:40:53 +0200
Subject: [PATCH] replace more dup() by F_DUPFD_CLOEXEC
---
src/login/inhibit.c | 2 +-
src/shared/install.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git src/login/inhibit.c src/login/inhibit.c
index 48c2ec4..ae3afdf 100644
--- src/login/inhibit.c
+++ src/login/inhibit.c
@@ -64,7 +64,7 @@ static int inhibit(sd_bus *bus, sd_bus_error *error) {
if (r < 0)
return r;
- r = dup(fd);
+ r = fcntl(fd, F_DUPFD_CLOEXEC, 3);
if (r < 0)
return -errno;
diff --git src/shared/install.c src/shared/install.c
index acfba25..9ce9403 100644
--- src/shared/install.c
+++ src/shared/install.c
@@ -332,7 +332,7 @@ static int remove_marked_symlinks(
int q, cfd;
deleted = false;
- cfd = dup(fd);
+ cfd = fcntl(fd, F_DUPFD_CLOEXEC, 3);
if (cfd < 0) {
r = -errno;
break;
--
1.7.9.2

View File

@ -1,181 +0,0 @@
From 42c4ebcbd4cbd7b27667eb8081ee4dc46f9ece17 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 13 Mar 2014 20:33:22 +0100
Subject: [PATCH] sd-bus: don't look for a 64bit value when we only have 32bit
value on reply cookie hash table access
This broke hashtable lookups for the message cookies on s390x, which is
a 64bit BE machine where accessing 32bit values as 64bit and vice versa
will explode.
Also, while we are at it, be a bit more careful when dealing with the
64bit cookies we expose and the 32bit serial numbers dbus uses in its
payload.
Problem identified by Fridrich Strba.
---
src/libsystemd/sd-bus/bus-dump.c | 4 ++--
src/libsystemd/sd-bus/bus-kernel.c | 2 +-
src/libsystemd/sd-bus/bus-message.c | 15 ++++++++++-----
src/libsystemd/sd-bus/bus-message.h | 5 +++--
src/libsystemd/sd-bus/sd-bus.c | 12 ++++++------
5 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
index 0e41549..ea81644 100644
--- a/src/libsystemd/sd-bus/bus-dump.c
+++ b/src/libsystemd/sd-bus/bus-dump.c
@@ -69,10 +69,10 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) {
if (BUS_MESSAGE_COOKIE(m) == 0xFFFFFFFFULL)
fprintf(f, " Cookie=-1");
else
- fprintf(f, " Cookie=%lu", (unsigned long) BUS_MESSAGE_COOKIE(m));
+ fprintf(f, " Cookie=%" PRIu64, BUS_MESSAGE_COOKIE(m));
if (m->reply_cookie != 0)
- fprintf(f, " ReplyCookie=%lu", (unsigned long) m->reply_cookie);
+ fprintf(f, " ReplyCookie=%" PRIu64, m->reply_cookie);
fputs("\n", f);
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 8a2ca02..80ef15b 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -266,7 +266,7 @@ static int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) {
well_known ? 0 :
m->destination ? unique : KDBUS_DST_ID_BROADCAST;
m->kdbus->payload_type = KDBUS_PAYLOAD_DBUS;
- m->kdbus->cookie = m->header->serial;
+ m->kdbus->cookie = (uint64_t) m->header->serial;
m->kdbus->priority = m->priority;
if (m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index fb894ef..97ab0e3 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -617,7 +617,7 @@ static int message_new_reply(
t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED;
t->reply_cookie = BUS_MESSAGE_COOKIE(call);
- r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, t->reply_cookie);
+ r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, (uint32_t) t->reply_cookie);
if (r < 0)
goto fail;
@@ -752,7 +752,7 @@ int bus_message_new_synthetic_error(
t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED;
t->reply_cookie = cookie;
- r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, t->reply_cookie);
+ r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, (uint32_t) t->reply_cookie);
if (r < 0)
goto fail;
@@ -5075,21 +5075,26 @@ int bus_message_parse_fields(sd_bus_message *m) {
break;
}
- case BUS_MESSAGE_HEADER_REPLY_SERIAL:
+ case BUS_MESSAGE_HEADER_REPLY_SERIAL: {
+ uint32_t serial;
+
if (m->reply_cookie != 0)
return -EBADMSG;
if (!streq(signature, "u"))
return -EBADMSG;
- r = message_peek_field_uint32(m, &ri, item_size, &m->reply_cookie);
+ r = message_peek_field_uint32(m, &ri, item_size, &serial);
if (r < 0)
return r;
+ m->reply_cookie = serial;
+
if (m->reply_cookie == 0)
return -EBADMSG;
break;
+ }
case BUS_MESSAGE_HEADER_UNIX_FDS:
if (unix_fds != 0)
@@ -5489,7 +5494,7 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
return -ENOMEM;
n->reply_cookie = (*m)->reply_cookie;
- r = message_append_field_uint32(n, BUS_MESSAGE_HEADER_REPLY_SERIAL, n->reply_cookie);
+ r = message_append_field_uint32(n, BUS_MESSAGE_HEADER_REPLY_SERIAL, (uint32_t) n->reply_cookie);
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h
index 5fbe3e6..df79294 100644
--- a/src/libsystemd/sd-bus/bus-message.h
+++ b/src/libsystemd/sd-bus/bus-message.h
@@ -84,7 +84,7 @@ struct sd_bus_message {
sd_bus *bus;
- uint32_t reply_cookie;
+ uint64_t reply_cookie;
const char *path;
const char *interface;
@@ -162,7 +162,8 @@ static inline uint64_t BUS_MESSAGE_BSWAP64(sd_bus_message *m, uint64_t u) {
return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_64(u) : u;
}
-static inline uint32_t BUS_MESSAGE_COOKIE(sd_bus_message *m) {
+static inline uint64_t BUS_MESSAGE_COOKIE(sd_bus_message *m) {
+ /* Note that we return the serial converted to a 64bit value here */
return BUS_MESSAGE_BSWAP32(m, m->header->serial);
}
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index ca7c428..8e44e50 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -1486,15 +1486,15 @@ static int bus_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call
return r;
if (bus->is_kernel || *idx >= BUS_MESSAGE_SIZE(m))
- log_debug("Sent message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%lu reply_cookie=%lu error=%s",
+ log_debug("Sent message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%" PRIu64 " reply_cookie=%" PRIu64 " error=%s",
bus_message_type_to_string(m->header->type),
strna(sd_bus_message_get_sender(m)),
strna(sd_bus_message_get_destination(m)),
strna(sd_bus_message_get_path(m)),
strna(sd_bus_message_get_interface(m)),
strna(sd_bus_message_get_member(m)),
- (unsigned long) BUS_MESSAGE_COOKIE(m),
- (unsigned long) m->reply_cookie,
+ BUS_MESSAGE_COOKIE(m),
+ m->reply_cookie,
strna(m->error.message));
return r;
@@ -2253,15 +2253,15 @@ static int process_message(sd_bus *bus, sd_bus_message *m) {
bus->current = m;
bus->iteration_counter++;
- log_debug("Got message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%lu reply_cookie=%lu error=%s",
+ log_debug("Got message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%" PRIu64 " reply_cookie=%" PRIu64 " error=%s",
bus_message_type_to_string(m->header->type),
strna(sd_bus_message_get_sender(m)),
strna(sd_bus_message_get_destination(m)),
strna(sd_bus_message_get_path(m)),
strna(sd_bus_message_get_interface(m)),
strna(sd_bus_message_get_member(m)),
- (unsigned long) BUS_MESSAGE_COOKIE(m),
- (unsigned long) m->reply_cookie,
+ BUS_MESSAGE_COOKIE(m),
+ m->reply_cookie,
strna(m->error.message));
r = process_hello(bus, m);
--
1.9.0

View File

@ -1,25 +0,0 @@
From ef7b6c0190fefaacf6d8f8e1a6dda4ba8b98091b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 29 Oct 2014 17:58:43 +0100
Subject: [PATCH] sd-bus: properly handle removals of non-existing matches
---
src/libsystemd/sd-bus/bus-match.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/libsystemd/sd-bus/bus-match.c src/libsystemd/sd-bus/bus-match.c
index 18afe0f..5658c61 100644
--- src/libsystemd/sd-bus/bus-match.c
+++ src/libsystemd/sd-bus/bus-match.c
@@ -537,7 +537,7 @@ static int bus_match_find_compare_value(
else if (BUS_MATCH_CAN_HASH(t))
n = hashmap_get(c->compare.children, value_str);
else {
- for (n = c->child; !value_node_same(n, t, value_u8, value_str); n = n->next)
+ for (n = c->child; n && !value_node_same(n, t, value_u8, value_str); n = n->next)
;
}
--
1.7.9.2

View File

@ -1,58 +0,0 @@
From 92daebc0d0268c35f416c1665e0da3d4be5dd69f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 11 Jul 2014 16:48:35 +0200
Subject: [PATCH] sd-event: don't require a signal event source to be enabled
for the child event source to work
---
src/libsystemd/sd-event/sd-event.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c
index a21f7db..9a9664c 100644
--- src/libsystemd/sd-event/sd-event.c
+++ src/libsystemd/sd-event/sd-event.c
@@ -1919,14 +1919,13 @@ static int process_signal(sd_event *e, uint32_t events) {
int r;
assert(e);
- assert(e->signal_sources);
assert_return(events == EPOLLIN, -EIO);
for (;;) {
struct signalfd_siginfo si;
ssize_t ss;
- sd_event_source *s;
+ sd_event_source *s = NULL;
ss = read(e->signal_fd, &si, sizeof(si));
if (ss < 0) {
@@ -1941,16 +1940,19 @@ static int process_signal(sd_event *e, uint32_t events) {
read_one = true;
- s = e->signal_sources[si.ssi_signo];
if (si.ssi_signo == SIGCHLD) {
r = process_child(e);
if (r < 0)
return r;
- if (r > 0 || !s)
+ if (r > 0)
continue;
- } else
- if (!s)
- return -EIO;
+ }
+
+ if (e->signal_sources)
+ s = e->signal_sources[si.ssi_signo];
+
+ if (!s)
+ continue;
s->signal.siginfo = si;
r = source_set_pending(s, true);
--
1.7.9.2

View File

@ -1,37 +0,0 @@
Based on eec6022cf039e62233139000b9e95db943959e48 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 5 Jun 2014 13:43:30 +0200
Subject: [PATCH] sd-event: restore correct timeout behaviour
---
src/libsystemd/sd-event/sd-event.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- src/libsystemd/sd-event/sd-event.c
+++ src/libsystemd/sd-event/sd-event.c 2014-06-06 10:26:51.422235695 +0000
@@ -2047,6 +2047,7 @@ _public_ int sd_event_run(sd_event *e, u
unsigned ev_queue_max;
sd_event_source *p;
int r, i, m;
+ bool timedout;
assert_return(e, -EINVAL);
assert_return(!event_pid_changed(e), -ECHILD);
@@ -2084,6 +2085,8 @@ _public_ int sd_event_run(sd_event *e, u
goto finish;
}
+ timedout = m == 0;
+
dual_timestamp_get(&e->timestamp);
for (i = 0; i < m; i++) {
@@ -2123,7 +2126,7 @@ _public_ int sd_event_run(sd_event *e, u
p = event_next_pending(e);
if (!p) {
- r = 1;
+ r = !timedout;
goto finish;
}

View File

@ -1,111 +0,0 @@
Backport of 7ca1d31964a2553f7bd011bc10ac42e0ebc1f975 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Fri, 2 May 2014 22:29:18 +0200
Subject: [PATCH] sd-rtnl-message: append - fix uninitialized memory
We were not properly clearing the padding at the front of some containers.
---
src/libsystemd/sd-rtnl/rtnl-message.c | 42 +++++++++++++++++++++-------------
1 file changed, 27 insertions(+), 15 deletions(-)
--- src/libsystemd/sd-rtnl/rtnl-message.c
+++ src/libsystemd/sd-rtnl/rtnl-message.c 2014-05-05 13:33:01.998235340 +0000
@@ -314,24 +314,28 @@ int sd_rtnl_message_link_get_flags(sd_rt
/* If successful the updated message will be correctly aligned, if
unsuccessful the old message is untouched. */
static int add_rtattr(sd_rtnl_message *m, unsigned short type, const void *data, size_t data_length) {
- uint32_t rta_length, message_length;
+ uint32_t rta_length;
+ size_t message_length, padding_length;
struct nlmsghdr *new_hdr;
struct rtattr *rta;
char *padding;
unsigned i;
+ int offset;
assert(m);
assert(m->hdr);
assert(!m->sealed);
assert(NLMSG_ALIGN(m->hdr->nlmsg_len) == m->hdr->nlmsg_len);
- assert(!data || data_length > 0);
- assert(data || m->n_containers < RTNL_CONTAINER_DEPTH);
+ assert(!data || data_length);
+
+ /* get offset of the new attribute */
+ offset = m->hdr->nlmsg_len;
/* get the size of the new rta attribute (with padding at the end) */
rta_length = RTA_LENGTH(data_length);
/* get the new message size (with padding at the end) */
- message_length = m->hdr->nlmsg_len + RTA_ALIGN(rta_length);
+ message_length = offset + RTA_ALIGN(rta_length);
/* realloc to fit the new attribute */
new_hdr = realloc(m->hdr, message_length);
@@ -340,32 +344,35 @@ static int add_rtattr(sd_rtnl_message *m
m->hdr = new_hdr;
/* get pointer to the attribute we are about to add */
- rta = (struct rtattr *) ((uint8_t *) m->hdr + m->hdr->nlmsg_len);
+ rta = (struct rtattr *) ((uint8_t *) m->hdr + offset);
/* if we are inside containers, extend them */
for (i = 0; i < m->n_containers; i++)
- GET_CONTAINER(m, i)->rta_len += message_length - m->hdr->nlmsg_len;
+ GET_CONTAINER(m, i)->rta_len += message_length - offset;
/* fill in the attribute */
rta->rta_type = type;
rta->rta_len = rta_length;
- if (!data) {
- /* this is the start of a new container */
- m->container_offsets[m->n_containers ++] = m->hdr->nlmsg_len;
- } else {
+ if (data)
/* we don't deal with the case where the user lies about the type
* and gives us too little data (so don't do that)
- */
+ */
padding = mempcpy(RTA_DATA(rta), data, data_length);
- /* make sure also the padding at the end of the message is initialized */
- memzero(padding,
- (uint8_t *) m->hdr + message_length - (uint8_t *) padding);
+ else {
+ /* if no data was passed, make sure we still initialize the padding
+ note that we can have data_length > 0 (used by some containers) */
+ padding = RTA_DATA(rta);
+ data_length = 0;
}
+ /* make sure also the padding at the end of the message is initialized */
+ padding_length = (uint8_t*)m->hdr + message_length - (uint8_t*)padding;
+ memzero(padding, padding_length);
+
/* update message size */
m->hdr->nlmsg_len = message_length;
- return 0;
+ return offset;
}
int sd_rtnl_message_append_string(sd_rtnl_message *m, unsigned short type, const char *data) {
@@ -498,6 +505,7 @@ int sd_rtnl_message_append_u32(sd_rtnl_m
assert_return(m, -EINVAL);
assert_return(!m->sealed, -EPERM);
+ assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -ERANGE);
r = sd_rtnl_message_get_type(m, &rtm_type);
if (r < 0)
@@ -548,6 +556,10 @@ int sd_rtnl_message_append_u32(sd_rtnl_m
if (r < 0)
return r;
+ m->container_offsets[m->n_containers ++] = r;
+
+ m->container_offsets[m->n_containers ++] = r;
+
return 0;
}

View File

@ -1,23 +0,0 @@
Based on 1e648011b20c8126412d3cf2699d575d9ba9e0fe Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Fri, 21 Nov 2014 17:02:15 +0100
Subject: [PATCH] selinux-access: fix broken ternary operator
it seems to be a typo introduced by ebcf1f97de4f6b1580ae55eb56b1a3939fe6b602
- _r = selinux_access_check(_b, _m, _u->source_path ?:_u->fragment_path, (permission), &_error); \
+ ({ Unit *_unit = (unit); selinux_generic_access_check(bus,message, _unit->fragment_path ?: _unit->fragment_path, permission,error); })
---
src/core/selinux-access.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- src/core/selinux-access.h
+++ src/core/selinux-access.h 2014-12-15 11:49:54.521518349 +0000
@@ -34,7 +34,7 @@ int selinux_generic_access_check(sd_bus
#define selinux_access_check(bus, message, permission, error) \
selinux_generic_access_check(bus, message, NULL, permission, error)
#define selinux_unit_access_check(unit, bus, message, permission, error) \
- ({ Unit *_unit = (unit); selinux_generic_access_check(bus, message, _unit->fragment_path ?: _unit->fragment_path, permission, error); })
+ ({ Unit *_unit = (unit); selinux_generic_access_check(bus, message, _unit->source_path ?: _unit->fragment_path, permission, error); })
#else

View File

@ -1,95 +0,0 @@
Based on f29c77bc0179b0fa57407dbe30b495be9f5ad2e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 14 Oct 2014 20:20:07 -0400
Subject: [PATCH] shell-completion: fix completion of inactive units
Units which not loaded were not proposed properly. OTOH, we should
filter units from get-unit-files by their state if they are currently
loaded. Bring zsh completions in line with bash completion, the same
logic should be used in both implementations.
https://bugzilla.redhat.com/show_bug.cgi?id=1024379
https://bugzilla.redhat.com/show_bug.cgi?id=790768
https://bugs.freedesktop.org/show_bug.cgi?id=84720
---
shell-completion/bash/systemctl | 17 +++++++++--------
shell-completion/zsh/_systemctl | 16 +++++++++-------
2 files changed, 18 insertions(+), 15 deletions(-)
--- shell-completion/bash/systemctl
+++ shell-completion/bash/systemctl
@@ -55,10 +55,14 @@ __get_all_units () { { __systemctl $1 list-unit-files; __systemctl $1 list-
| { while read -r a b; do echo " $a"; done; }; }
__get_active_units () { __systemctl $1 list-units \
| { while read -r a b; do echo " $a"; done; }; }
-__get_startable_units () { {
- __systemctl $1 list-units --all -t service,timer,socket,mount,automount,path,snapshot,swap
- __systemctl $1 list-unit-files -t service,timer,socket,mount,automount,path,snapshot,swap; } \
- | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo " $a"; done; }; }
+__get_startable_units () {
+ # find inactive or failed units, filter out masked and not-found
+ __systemctl $1 list-units --state inactive,failed -- $( __get_all_units ) | \
+ { while read -r a b c d; do [[ $b == "loaded" ]] && echo " $a"; done; }; }
+__get_restartable_units () {
+ # find !masked, filter out masked and not-found
+ __systemctl $1 list-units --state active,inactive,failed -- $( __get_all_units ) | \
+ { while read -r a b c d; do [[ $b == "loaded" ]] && echo " $a"; done; }; }
__get_failed_units () { __systemctl $1 list-units \
| { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; }
__get_enabled_units () { __systemctl $1 list-unit-files \
@@ -180,10 +184,7 @@ _systemctl () {
elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
comps=$( __filter_units_by_property $mode CanStart yes \
- $( __get_all_units $mode \
- | while read -r line; do \
- [[ "$line" =~ @\.|\.(device|snapshot|socket|timer)$ ]] || echo " $line"; \
- done ))
+ $( __get_restartable_units $mode))
compopt -o filenames
elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
--- shell-completion/zsh/_systemctl
+++ shell-completion/zsh/_systemctl
@@ -138,8 +138,11 @@ _filter_units_by_property() {
done
}
+_systemctl_all_units() { { __systemctl list-unit-files; __systemctl list-units --all; } | { while read -r a b; do echo -E - " $a"; done; } }
+
_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read -r a b; do echo -E - " $a"; done; }) )}
-_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all | { while read -r a b c d; do [[ $c == "inactive" || $c == "failed" ]] && echo -E - " $a"; done; }) )}
+_systemctl_startable_units(){_sys_startable_units=($(__systemctl list-units --state inactive,failed -- $(_systemctl_all_units) | { while read -r a b c d; do [[ $b == "loaded" ]] && echo -E - " $a"; done; }) )}
+_systemctl_restartable_units(){_sys_restartable_units=($(__systemctl list-units --state inactive,failed,active -- $(_systemctl_all_units) | { while read -r a b c d; do [[ $b == "loaded" ]] && echo -E - " $a"; done; }) )}
_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read -r a b; do echo -E - " $a"; done; }) )}
_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read -r a b; do [[ $b == "enabled" ]] && echo -E - " $a"; done; }) )}
_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read -r a b; do [[ $b == "disabled" ]] && echo -E - " $a"; done; }) )}
@@ -181,8 +184,9 @@ done
# Completion functions for STARTABLE_UNITS
(( $+functions[_systemctl_start] )) || _systemctl_start()
{
- _systemctl_inactive_units
- compadd "$@" -a - _sys_inactive_units
+ _systemctl_startable_units
+ compadd "$@" - $( _filter_units_by_property CanStart yes \
+ ${_sys_startable_units[*]} )
}
# Completion functions for STOPPABLE_UNITS
@@ -217,11 +221,9 @@ done
for fun in restart reload-or-restart ; do
(( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
{
- _systemctl_all_units
+ _systemctl_restartable_units
compadd "$@" - $( _filter_units_by_property CanStart yes \
- ${_sys_all_units[*]} | while read -r line; do \
- [[ "$line" =~ \.device$ ]] || echo -E - " $line"; \
- done )
+ ${_sys_restartable_units[*]} )
}
done
--
1.7.9.2

View File

@ -1,30 +0,0 @@
From b748c7596f79945be5263a0d1c88de64eb0c5146 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Sat, 27 Sep 2014 00:25:09 +0200
Subject: [PATCH] shutdownd: clean up initialization of struct
No functional change. We just don't assign the value twice.
Found by coverity. Fixes: CID#1237616 and #1237617
---
src/shutdownd/shutdownd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git src/shutdownd/shutdownd.c src/shutdownd/shutdownd.c
index 99aa4b3..0f008a6 100644
--- src/shutdownd/shutdownd.c
+++ src/shutdownd/shutdownd.c
@@ -52,8 +52,8 @@ static int read_packet(int fd, union shutdown_buffer *_b) {
union shutdown_buffer b; /* We maintain our own copy here, in
* order not to corrupt the last message */
struct iovec iovec = {
- iovec.iov_base = &b,
- iovec.iov_len = sizeof(b) - 1,
+ .iov_base = &b,
+ .iov_len = sizeof(b) - 1,
};
union {
struct cmsghdr cmsghdr;
--
1.7.9.2

View File

@ -1,414 +0,0 @@
Based on 16115b0a7b7cdf08fb38084d857d572d8a9088dc Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Thu, 24 Jul 2014 10:40:28 +0200
Subject: [PATCH] socket: introduce SELinuxContextFromNet option
This makes possible to spawn service instances triggered by socket with
MLS/MCS SELinux labels which are created based on information provided by
connected peer.
Implementation of label_get_child_mls_label derived from xinetd.
Reviewed-by: Paul Moore <pmoore@redhat.com>
---
man/systemd.socket.xml | 26 +++++++
src/core/execute.c | 30 +++++++--
src/core/execute.h | 1
src/core/load-fragment-gperf.gperf.m4 | 3
src/core/mount.c | 1
src/core/service.c | 4 -
src/core/service.h | 3
src/core/socket.c | 16 +++-
src/core/socket.h | 2
src/core/swap.c | 1
src/shared/label.c | 113 ++++++++++++++++++++++++++++++++++
src/shared/label.h | 2
12 files changed, 191 insertions(+), 11 deletions(-)
--- man/systemd.socket.xml
+++ man/systemd.socket.xml 2014-09-23 15:36:49.000000000 +0000
@@ -570,6 +570,32 @@
</varlistentry>
<varlistentry>
+ <term><varname>SELinuxContextFromNet=</varname></term>
+ <listitem><para>Takes a boolean
+ argument. When true systemd will attempt
+ to figure out the SELinux label used
+ for the instantiated service from the
+ information handed by the peer over the
+ network. Note that only the security
+ level is used from the information
+ provided by the peer. Other parts of
+ the resulting SELinux context originate
+ from either the target binary that is
+ effectively triggered by socket unit
+ are taken from the value of the
+ <varname>SELinuxContext=</varname>
+ option.This configuration option only
+ affects sockets with
+ <varname>Accept=</varname> mode set to
+ <literal>true</literal>. Also note that
+ this option is useful only when
+ MLS/MCS SELinux policy is
+ deployed. Defaults to
+ <literal>false</literal>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><varname>PipeSize=</varname></term>
<listitem><para>Takes an size in
bytes. Controls the pipe buffer size
--- src/core/execute.c
+++ src/core/execute.c 2014-09-24 09:22:08.882735864 +0000
@@ -82,6 +82,7 @@
#include "selinux-util.h"
#include "errno-list.h"
#include "apparmor-util.h"
+#include "label.h"
#ifdef HAVE_SECCOMP
#include "seccomp-util.h"
@@ -1123,6 +1124,7 @@ int exec_spawn(ExecCommand *command,
bool apply_chroot,
bool apply_tty_stdin,
bool confirm_spawn,
+ bool selinux_context_net,
CGroupControllerMask cgroup_supported,
const char *cgroup_path,
const char *unit_id,
@@ -1594,11 +1596,29 @@ int exec_spawn(ExecCommand *command,
#endif
#ifdef HAVE_SELINUX
- if (context->selinux_context && use_selinux()) {
- err = setexeccon(context->selinux_context);
- if (err < 0 && !context->selinux_context_ignore) {
- r = EXIT_SELINUX_CONTEXT;
- goto fail_child;
+ if (use_selinux()) {
+ if (context->selinux_context) {
+ err = setexeccon(context->selinux_context);
+ if (err < 0 && !context->selinux_context_ignore) {
+ r = EXIT_SELINUX_CONTEXT;
+ goto fail_child;
+ }
+ }
+
+ if (selinux_context_net && socket_fd >= 0) {
+ _cleanup_free_ char *label = NULL;
+
+ err = label_get_child_mls_label(socket_fd, command->path, &label);
+ if (err < 0) {
+ r = EXIT_SELINUX_CONTEXT;
+ goto fail_child;
+ }
+
+ err = setexeccon(label);
+ if (err < 0) {
+ r = EXIT_SELINUX_CONTEXT;
+ goto fail_child;
+ }
}
}
#endif
--- src/core/execute.h
+++ src/core/execute.h 2014-09-23 15:46:26.000000000 +0000
@@ -195,6 +195,7 @@ int exec_spawn(ExecCommand *command,
bool apply_chroot,
bool apply_tty_stdin,
bool confirm_spawn,
+ bool selinux_context_net,
CGroupControllerMask cgroup_mask,
const char *cgroup_path,
const char *unit_id,
--- src/core/load-fragment-gperf.gperf.m4
+++ src/core/load-fragment-gperf.gperf.m4 2014-09-23 00:00:00.000000000 +0000
@@ -242,6 +242,9 @@ Socket.SmackLabelIPOut, config_
`Socket.SmackLabel, config_parse_warn_compat, 0, 0
Socket.SmackLabelIPIn, config_parse_warn_compat, 0, 0
Socket.SmackLabelIPOut, config_parse_warn_compat, 0, 0')
+m4_ifdef(`HAVE_SELINUX',
+`Socket.SELinuxContextFromNet, config_parse_bool, 0, offsetof(Socket, selinux_context_from_net)',
+`Socket.SELinuxContextFromNet, config_parse_warn_compat, 0, 0')
EXEC_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl
CGROUP_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl
KILL_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl
--- src/core/mount.c
+++ src/core/mount.c 2014-09-24 09:16:26.234235379 +0000
@@ -785,6 +785,7 @@ static int mount_spawn(Mount *m, ExecCom
true,
true,
UNIT(m)->manager->confirm_spawn,
+ false,
UNIT(m)->manager->cgroup_supported,
UNIT(m)->cgroup_path,
UNIT(m)->id,
--- src/core/service.c
+++ src/core/service.c 2014-09-23 15:49:24.000000000 +0000
@@ -1856,6 +1856,7 @@ static int service_spawn(
apply_chroot,
apply_tty_stdin,
UNIT(s)->manager->confirm_spawn,
+ s->socket_fd_selinux_context_net,
UNIT(s)->manager->cgroup_supported,
path,
UNIT(s)->id,
@@ -3787,7 +3788,7 @@ static void service_bus_name_owner_chang
}
}
-int service_set_socket_fd(Service *s, int fd, Socket *sock) {
+int service_set_socket_fd(Service *s, int fd, Socket *sock, bool selinux_context_net) {
_cleanup_free_ char *peer = NULL;
int r;
@@ -3825,6 +3826,7 @@ int service_set_socket_fd(Service *s, in
}
s->socket_fd = fd;
+ s->socket_fd_selinux_context_net = selinux_context_net;
unit_ref_set(&s->accept_socket, UNIT(sock));
--- src/core/service.h
+++ src/core/service.h 2014-09-23 15:51:13.000000000 +0000
@@ -159,6 +159,7 @@ struct Service {
pid_t main_pid, control_pid;
int socket_fd;
+ bool socket_fd_selinux_context_net;
bool permissions_start_only;
bool root_directory_start_only;
bool remain_after_exit;
@@ -204,7 +205,7 @@ extern const UnitVTable service_vtable;
struct Socket;
-int service_set_socket_fd(Service *s, int fd, struct Socket *socket);
+int service_set_socket_fd(Service *s, int fd, struct Socket *socket, bool selinux_context_net);
const char* service_state_to_string(ServiceState i) _const_;
ServiceState service_state_from_string(const char *s) _pure_;
--- src/core/socket.c
+++ src/core/socket.c 2014-09-24 09:13:29.698735735 +0000
@@ -453,7 +453,8 @@ static void socket_dump(Unit *u, FILE *f
"%sBroadcast: %s\n"
"%sPassCredentials: %s\n"
"%sPassSecurity: %s\n"
- "%sTCPCongestion: %s\n",
+ "%sTCPCongestion: %s\n"
+ "%sSELinuxContextFromNet: %s\n",
prefix, socket_state_to_string(s->state),
prefix, socket_result_to_string(s->result),
prefix, socket_address_bind_ipv6_only_to_string(s->bind_ipv6_only),
@@ -466,7 +467,8 @@ static void socket_dump(Unit *u, FILE *f
prefix, yes_no(s->broadcast),
prefix, yes_no(s->pass_cred),
prefix, yes_no(s->pass_sec),
- prefix, strna(s->tcp_congestion));
+ prefix, strna(s->tcp_congestion),
+ prefix, yes_no(s->selinux_context_from_net));
if (s->control_pid > 0)
fprintf(f,
@@ -1000,7 +1002,12 @@ static int socket_open_fds(Socket *s) {
if (p->type == SOCKET_SOCKET) {
- if (!know_label) {
+ if (!know_label && s->selinux_context_from_net) {
+ r = label_get_our_label(&label);
+ if (r < 0)
+ return r;
+ know_label = true;
+ } else if (!know_label) {
if ((r = socket_instantiate_service(s)) < 0)
return r;
@@ -1247,6 +1254,7 @@ static int socket_spawn(Socket *s, ExecC
true,
true,
UNIT(s)->manager->confirm_spawn,
+ s->selinux_context_from_net,
UNIT(s)->manager->cgroup_supported,
UNIT(s)->cgroup_path,
UNIT(s)->id,
@@ -1568,7 +1576,7 @@ static void socket_enter_running(Socket
unit_choose_id(UNIT(service), name);
- r = service_set_socket_fd(service, cfd, s);
+ r = service_set_socket_fd(service, cfd, s, s->selinux_context_from_net);
if (r < 0)
goto fail;
--- src/core/socket.h
+++ src/core/socket.h 2014-09-23 15:55:17.000000000 +0000
@@ -154,6 +154,8 @@ struct Socket {
char *smack;
char *smack_ip_in;
char *smack_ip_out;
+
+ bool selinux_context_from_net;
};
/* Called from the service code when collecting fds */
--- src/core/swap.c
+++ src/core/swap.c 2014-09-24 09:17:18.438735618 +0000
@@ -642,6 +642,7 @@ static int swap_spawn(Swap *s, ExecComma
true,
true,
UNIT(s)->manager->confirm_spawn,
+ false,
UNIT(s)->manager->cgroup_supported,
UNIT(s)->cgroup_path,
UNIT(s)->id,
--- src/shared/label.c
+++ src/shared/label.c 2014-09-23 00:00:00.000000000 +0000
@@ -31,6 +31,7 @@
#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
+#include <selinux/context.h>
#endif
#include "label.h"
@@ -41,6 +42,12 @@
#include "smack-util.h"
#ifdef HAVE_SELINUX
+DEFINE_TRIVIAL_CLEANUP_FUNC(security_context_t, freecon);
+DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free);
+
+#define _cleanup_security_context_free_ _cleanup_(freeconp)
+#define _cleanup_context_free_ _cleanup_(context_freep)
+
static struct selabel_handle *label_hnd = NULL;
#endif
@@ -243,6 +250,112 @@ fail:
return r;
}
+int label_get_our_label(char **label) {
+ int r = -EOPNOTSUPP;
+ char *l = NULL;
+
+#ifdef HAVE_SELINUX
+ r = getcon(&l);
+ if (r < 0)
+ return r;
+
+ *label = l;
+#endif
+
+ return r;
+}
+
+int label_get_child_mls_label(int socket_fd, const char *exe, char **label) {
+ int r = -EOPNOTSUPP;
+
+#ifdef HAVE_SELINUX
+
+ _cleanup_security_context_free_ security_context_t mycon = NULL, peercon = NULL, fcon = NULL, ret = NULL;
+ _cleanup_context_free_ context_t pcon = NULL, bcon = NULL;
+ security_class_t sclass;
+
+ const char *range = NULL;
+
+ assert(socket_fd >= 0);
+ assert(exe);
+ assert(label);
+
+ r = getcon(&mycon);
+ if (r < 0) {
+ r = -EINVAL;
+ goto out;
+ }
+
+ r = getpeercon(socket_fd, &peercon);
+ if (r < 0) {
+ r = -EINVAL;
+ goto out;
+ }
+
+ r = getexeccon(&fcon);
+ if (r < 0) {
+ r = -EINVAL;
+ goto out;
+ }
+
+ if (!fcon) {
+ /* If there is no context set for next exec let's use context
+ of target executable */
+ r = getfilecon(exe, &fcon);
+ if (r < 0) {
+ r = -errno;
+ goto out;
+ }
+ }
+
+ bcon = context_new(mycon);
+ if (!bcon) {
+ r = -ENOMEM;
+ goto out;
+ }
+
+ pcon = context_new(peercon);
+ if (!pcon) {
+ r = -ENOMEM;
+ goto out;
+ }
+
+ range = context_range_get(pcon);
+ if (!range) {
+ r = -errno;
+ goto out;
+ }
+
+ r = context_range_set(bcon, range);
+ if (r) {
+ r = -errno;
+ goto out;
+ }
+
+ freecon(mycon);
+ mycon = context_str(bcon);
+ if (!mycon) {
+ r = -errno;
+ goto out;
+ }
+
+ sclass = string_to_security_class("process");
+ r = security_compute_create(mycon, fcon, sclass, &ret);
+ if (r < 0) {
+ r = -EINVAL;
+ goto out;
+ }
+
+ *label = ret;
+ r = 0;
+
+out:
+ if (r < 0 && security_getenforce() == 1)
+ return r;
+#endif
+ return r;
+}
+
int label_context_set(const char *path, mode_t mode) {
int r = 0;
--- src/shared/label.h
+++ src/shared/label.h 2014-09-23 00:00:00.000000000 +0000
@@ -40,6 +40,8 @@ void label_context_clear(void);
void label_free(const char *label);
int label_get_create_label_from_exe(const char *exe, char **label);
+int label_get_our_label(char **label);
+int label_get_child_mls_label(int socket_fd, const char *exec, char **label);
int label_mkdir(const char *path, mode_t mode);

View File

@ -1,35 +0,0 @@
Based on 97569e154b80541cbad39d78231b7f360d4ff058 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 21 Oct 2014 14:01:28 +0200
Subject: [PATCH] strv: add an additional overflow check when enlarging
strv()s
https://bugs.freedesktop.org/show_bug.cgi?id=76745
---
src/shared/strv.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
--- src/shared/strv.c
+++ src/shared/strv.c 2014-10-23 00:00:00.000000000 +0000
@@ -361,13 +361,19 @@ char *strv_join_quoted(char **l) {
int strv_push(char ***l, char *value) {
char **c;
- unsigned n;
+ unsigned n, m;
if (!value)
return 0;
n = strv_length(*l);
- c = realloc(*l, sizeof(char*) * (n + 2));
+
+ /* increase and check for overflow */
+ m = n + 2;
+ if (m < n)
+ return -ENOMEM;
+
+ c = realloc(*l, sizeof(char*) * (size_t) m);
if (!c)
return -ENOMEM;

View File

@ -1,28 +0,0 @@
From 498cfc230af8f83675be2e92057956f1792969e4 Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Date: Sat, 23 Aug 2014 21:11:44 +0200
Subject: [PATCH] systemctl: Correct error message printed when
bus_process_wait fails
Actually use the variable containing the return code of bus_process_wait when
printing the error message as a result of it failing.
---
src/systemctl/systemctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c
index d9b8bee..6534819 100644
--- src/systemctl/systemctl.c
+++ src/systemctl/systemctl.c
@@ -2382,7 +2382,7 @@ static int wait_for_jobs(sd_bus *bus, Set *s) {
while (!set_isempty(s)) {
q = bus_process_wait(bus);
if (q < 0) {
- log_error("Failed to wait for response: %s", strerror(-r));
+ log_error("Failed to wait for response: %s", strerror(-q));
return q;
}
--
1.7.9.2

View File

@ -1,51 +0,0 @@
From a1484a216e79da1fa7e2323095fb1b7203fb7a17 Mon Sep 17 00:00:00 2001
From: Djalal Harouni <tixxdz@opendz.org>
Date: Mon, 14 Apr 2014 01:07:52 +0100
Subject: [PATCH] systemctl: allow to change the default target without the
--force switch
Currently "systemctl set-default" will fail to change the default target
due to the 'default.target' being a symlink which is always the case.
To work around this, the user must specify the "--force" switch to be
able to overwrite the existing symlink.
This is clearly a regression that was introduced by commit 718db96199e
since it worked before without the "--force" switch and the man pages do
not mention that you need to specify it. It is expected that this is a
symlink.
So just explicity set the force flag to make it work again.
https://bugs.freedesktop.org/show_bug.cgi?id=76623
Reported-by: <code@progandy.de>
---
src/systemctl/systemctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c
index ee0938f..1b381f7 100644
--- src/systemctl/systemctl.c
+++ src/systemctl/systemctl.c
@@ -1968,7 +1968,7 @@ static int set_default(sd_bus *bus, char **args) {
return log_oom();
if (!bus || avoid_bus()) {
- r = unit_file_set_default(arg_scope, arg_root, unit, arg_force, &changes, &n_changes);
+ r = unit_file_set_default(arg_scope, arg_root, unit, true, &changes, &n_changes);
if (r < 0) {
log_error("Failed to set default target: %s", strerror(-r));
return r;
@@ -1990,7 +1990,7 @@ static int set_default(sd_bus *bus, char **args) {
"SetDefaultTarget",
&error,
&reply,
- "sb", unit, arg_force);
+ "sb", unit, true);
if (r < 0) {
log_error("Failed to set default target: %s", bus_error_message(&error, -r));
return r;
--
1.7.9.2

View File

@ -1,94 +0,0 @@
Based on 6c71341aeecc3d092ed90f66e1b2c481b8e260ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 29 Oct 2014 22:46:30 -0400
Subject: [PATCH] systemctl: let list-{units,unit-files } honour --type
The docs don't clarify what is expected, but I don't see any reason
why --type should be ignored.
Also restucture the compund conditions into separate clauses for
easier reading.
---
src/systemctl/systemctl.c | 48 ++++++++++++++++++++++++++++++++++-----------
1 file changed, 37 insertions(+), 11 deletions(-)
--- src/systemctl/systemctl.c
+++ src/systemctl/systemctl.c 2014-11-18 00:00:00.000000000 +0000
@@ -305,21 +305,37 @@ static int compare_unit_info(const void
}
static bool output_show_unit(const UnitInfo *u, char **patterns) {
- const char *dot;
-
if (!strv_isempty(patterns)) {
char **pattern;
STRV_FOREACH(pattern, patterns)
if (fnmatch(*pattern, u->id, FNM_NOESCAPE) == 0)
- return true;
+ goto next;
return false;
}
- return (!arg_types || ((dot = strrchr(u->id, '.')) &&
- strv_find(arg_types, dot+1))) &&
- (arg_all || !(streq(u->active_state, "inactive")
- || u->following[0]) || u->job_id > 0);
+next:
+ if (arg_types) {
+ const char *dot;
+
+ dot = strrchr(u->id, '.');
+ if (!dot)
+ return false;
+
+ if (!strv_find(arg_types, dot+1))
+ return false;
+ }
+
+ if (arg_all)
+ return true;
+
+ if (u->job_id > 0)
+ return true;
+
+ if (streq(u->active_state, "inactive") || u->following[0])
+ return false;
+
+ return true;
}
static void output_units_list(const UnitInfo *unit_infos, unsigned c) {
@@ -1019,18 +1035,28 @@ static int compare_unit_file_list(const
}
static bool output_show_unit_file(const UnitFileList *u, char **patterns) {
- const char *dot;
-
if (!strv_isempty(patterns)) {
char **pattern;
STRV_FOREACH(pattern, patterns)
if (fnmatch(*pattern, basename(u->path), FNM_NOESCAPE) == 0)
- return true;
+ goto next;
return false;
}
- return !arg_types || ((dot = strrchr(u->path, '.')) && strv_find(arg_types, dot+1));
+next:
+ if (!strv_isempty(arg_types)) {
+ const char *dot;
+
+ dot = strrchr(u->path, '.');
+ if (!dot)
+ return false;
+
+ if (!strv_find(arg_types, dot+1))
+ return false;
+ }
+
+ return true;
}
static void output_unit_file_list(const UnitFileList *units, unsigned c) {

View File

@ -1,52 +0,0 @@
From 08073121d8171f8e6be27b0c80e2ec283064760e Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 13 Oct 2014 15:43:09 +0200
Subject: [PATCH] systemctl: when mangle unit names for the "isolate", suffix
with ".target" rather than ".service" by default
After all, we set AllowIsolate exclusively for target units so far, and
this is more or less the only thing tht makes sense, hence also use
".target" as completion suffix by default.
---
src/systemctl/systemctl.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c
index 842ca6c..af3cc97 100644
--- src/systemctl/systemctl.c
+++ src/systemctl/systemctl.c
@@ -2704,7 +2704,7 @@ static enum action verb_to_action(const char *verb) {
static int start_unit(sd_bus *bus, char **args) {
_cleanup_set_free_free_ Set *s = NULL;
_cleanup_strv_free_ char **names = NULL;
- const char *method, *mode, *one_name;
+ const char *method, *mode, *one_name, *suffix = NULL;
char **name;
int r = 0;
@@ -2717,8 +2717,11 @@ static int start_unit(sd_bus *bus, char **args) {
method = verb_to_method(args[0]);
action = verb_to_action(args[0]);
- mode = streq(args[0], "isolate") ? "isolate" :
- action_table[action].mode ?: arg_job_mode;
+ if (streq(args[0], "isolate")) {
+ mode = "isolate";
+ suffix = ".target";
+ } else
+ mode = action_table[action].mode ?: arg_job_mode;
one_name = action_table[action].target;
} else {
@@ -2734,7 +2737,7 @@ static int start_unit(sd_bus *bus, char **args) {
if (one_name)
names = strv_new(one_name, NULL);
else {
- r = expand_names(bus, args + 1, NULL, &names);
+ r = expand_names(bus, args + 1, suffix, &names);
if (r < 0)
log_error("Failed to expand names: %s", strerror(-r));
}
--
1.7.9.2

View File

@ -1,50 +0,0 @@
Based on d677d4df80e0ea1c66c691f50867fedd63c6770a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 16 Oct 2014 19:12:55 -0500
Subject: [PATCH] systemd: continue switch-root even if umount fails
Leaving the old root around seems better than aborting the
switch.
---
src/core/main.c | 2 +-
src/core/switch-root.c | 11 +++++------
2 files changed, 6 insertions(+), 7 deletions(-)
--- src/core/main.c
+++ src/core/main.c 2014-10-20 13:35:35.915837828 +0000
@@ -1848,7 +1848,7 @@ finish:
/* And switch root */
r = switch_root(switch_root_dir);
if (r < 0)
- log_error("Failed to switch root, ignoring: %s", strerror(-r));
+ log_error("Failed to switch root, trying to continue: %s", strerror(-r));
}
args_size = MAX(6, argc+1);
--- src/core/switch-root.c
+++ src/core/switch-root.c 2014-10-20 13:39:58.167121460 +0000
@@ -68,10 +68,9 @@ int switch_root(const char *new_root) {
goto fail;
}
- /* Work-around for a kernel bug: for some reason the kernel
- * refuses switching root if any file systems are mounted
- * MS_SHARED. Hence remount them MS_PRIVATE here as a
- * work-around.
+ /* Work-around for kernel design: the kernel refuses switching
+ * root if any file systems are mounted MS_SHARED. Hence
+ * remount them MS_PRIVATE here as a work-around.
*
* https://bugzilla.redhat.com/show_bug.cgi?id=847418 */
if (mount(NULL, "/", NULL, MS_REC|MS_PRIVATE, NULL) < 0)
@@ -124,8 +123,8 @@ int switch_root(const char *new_root) {
* running off it we need to do this lazily. */
if (umount2("/mnt", MNT_DETACH) < 0) {
r = -errno;
- log_error("Failed to umount old root dir /mnt: %m");
- goto fail;
+ log_error("Failed to lazily umount old root dir /mnt, %s: %m",
+ errno == ENOENT ? "ignoring" : "leaving it around");
}
} else if (mount(new_root, "/", NULL, MS_MOVE, NULL) < 0) {

View File

@ -1,72 +0,0 @@
From f41925b4e442a34c93ad120ef1426c974a047ed1 Mon Sep 17 00:00:00 2001
From: Thomas Blume <Thomas.Blume@suse.com>
Date: Fri, 18 Jul 2014 09:13:36 -0400
Subject: [PATCH] systemd-detect-virt: detect s390 virtualization
A system that is running on a logical partition (LPAR) provided by
PR/SM has access to physical hardware (except CPU). It is true that
PR/SM abstracts the hardware, but only for sharing purposes.
Details are statet at:
http://publib.boulder.ibm.com/infocenter/eserver/v1r2/topic/eicaz/eicazzlpar.htm
-->--
In other words, PR/SM transforms physical resources into virtual resources so
that many logical partitions can share the same physical resources.
--<--
Still, from the OS point of view, the shared virtual resource is real
hardware. ConditionVirtualization must be set to false if the OS runs
directly on PR/SM (e.g. in an LPAR).
[zj: reorder code so that variables are not allocated when #if-def is
false. Add commit message.]
---
man/systemd.unit.xml | 1 +
src/shared/virt.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git man/systemd.unit.xml man/systemd.unit.xml
index 6447584..86a8cbb 100644
--- man/systemd.unit.xml
+++ man/systemd.unit.xml
@@ -996,6 +996,7 @@
virtualization solution, or one of
<varname>qemu</varname>,
<varname>kvm</varname>,
+ <varname>zvm</varname>,
<varname>vmware</varname>,
<varname>microsoft</varname>,
<varname>oracle</varname>,
diff --git src/shared/virt.c src/shared/virt.c
index 20a8d7c..b436895 100644
--- src/shared/virt.c
+++ src/shared/virt.c
@@ -220,6 +220,23 @@ int detect_vm(const char **id) {
goto finish;
}
+#if defined(__s390__)
+ {
+ _cleanup_free_ char *t = NULL;
+
+ r = get_status_field("/proc/sysinfo", "VM00 Control Program:", &t);
+ if (r >= 0) {
+ if (streq(t, "z/VM"))
+ _id = "zvm";
+ else
+ _id = "kvm";
+ r = 1;
+
+ goto finish;
+ }
+ }
+#endif
+
r = 0;
finish:
--
1.7.9.2

View File

@ -1,39 +0,0 @@
From 9ed2a35e93f4a9e82585f860f54cdcbbdf3e1f86 Mon Sep 17 00:00:00 2001
From: Richard Weinberger <richard@nod.at>
Date: Tue, 9 Sep 2014 11:09:37 +0200
Subject: [PATCH] systemd-tmpfiles: Fix IGNORE_DIRECTORY_PATH age handling
If one has a config like:
d /tmp 1777 root root -
X /tmp/important_mount
All files below /tmp/important_mount will be deleted as the
/tmp/important_mount item will spuriously inherit a max age of 0
from /tmp.
/tmp has a max age of 0 but age_set is (of course) false.
This affects also the PrivateTmp feature of systemd.
All tmp files of such services will be deleted unconditionally
and can cause service failures and data loss.
Fix this by checking ->age_set in the IGNORE_DIRECTORY_PATH logic.
---
src/tmpfiles/tmpfiles.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/tmpfiles/tmpfiles.c src/tmpfiles/tmpfiles.c
index f9830c4..7eafd6b 100644
--- src/tmpfiles/tmpfiles.c
+++ src/tmpfiles/tmpfiles.c
@@ -1576,7 +1576,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
candidate_item = j;
}
- if (candidate_item) {
+ if (candidate_item && candidate_item->age_set) {
i->age = candidate_item->age;
i->age_set = true;
}
--
1.7.9.2

View File

@ -1,34 +0,0 @@
Based on 805b573fad06b845502e76f3db3a0efa7583149d Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Wed, 23 Jul 2014 12:49:14 +0200
Subject: [PATCH] sysv: order initscripts which provide $network before
network.target
Due to recent changes where $network "maps" to network-online.target
it is not guaranteed that initscript which provides networking will
be terminated after network.target during shutdown which is against LSB.
---
src/core/service.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- src/core/service.c
+++ src/core/service.c 2014-07-30 11:27:16.074235995 +0000
@@ -820,7 +820,7 @@ static int service_load_sysv_path(Servic
if (unit_name_to_type(m) == UNIT_SERVICE)
r = unit_merge_by_name(u, m);
- else
+ else {
/* NB: SysV targets
* which are provided
* by a service are
@@ -835,6 +835,9 @@ static int service_load_sysv_path(Servic
* in the SysV
* services! */
r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, UNIT_WANTS, m, NULL, true);
+ if (r >= 0 && streq(m, SPECIAL_NETWORK_ONLINE_TARGET))
+ r = unit_add_dependency_by_name(u, UNIT_BEFORE, SPECIAL_NETWORK_TARGET, NULL, true);
+ }
if (r < 0)
log_error_unit(u->id,

View File

@ -1,26 +0,0 @@
From e7aab5412829ed6b50d109f670bd0b1b365838a7 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Sat, 11 Oct 2014 20:35:06 -0400
Subject: [PATCH] tmpfiles: compare return against correct errno
name_to_handle_at returns -EOPNOTSUPP, not -ENOTSUP.
---
src/tmpfiles/tmpfiles.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/tmpfiles/tmpfiles.c src/tmpfiles/tmpfiles.c
index dafb9ae..8108b43 100644
--- src/tmpfiles/tmpfiles.c
+++ src/tmpfiles/tmpfiles.c
@@ -259,7 +259,7 @@ static int dir_is_mount_point(DIR *d, const char *subdir) {
/* got only one handle; assume different mount points if one
* of both queries was not supported by the filesystem */
- if (r_p == -ENOSYS || r_p == -ENOTSUP || r == -ENOSYS || r == -ENOTSUP)
+ if (r_p == -ENOSYS || r_p == -EOPNOTSUPP || r == -ENOSYS || r == -EOPNOTSUPP)
return true;
/* return error */
--
1.7.9.2

View File

@ -1,27 +0,0 @@
From a606871da508995f5ede113a8fc6538afd98966c Mon Sep 17 00:00:00 2001
From: Greg KH <gregkh@linuxfoundation.org>
Date: Tue, 15 Apr 2014 14:12:01 -0700
Subject: [PATCH] tmpfiles: fix permissions on new journal files
When starting up journald on a new system, set the proper permissions on
the system.journal files, not only on the journal directory.
---
tmpfiles.d/systemd.conf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git tmpfiles.d/systemd.conf tmpfiles.d/systemd.conf
index 7c6d6b9..c470045 100644
--- tmpfiles.d/systemd.conf
+++ tmpfiles.d/systemd.conf
@@ -23,6 +23,6 @@ d /run/systemd/machines 0755 root root -
d /run/systemd/shutdown 0755 root root -
m /var/log/journal 2755 root systemd-journal - -
-m /var/log/journal/%m 2755 root systemd-journal - -
+Z /var/log/journal/%m 2755 root systemd-journal - -
m /run/log/journal 2755 root systemd-journal - -
-m /run/log/journal/%m 2755 root systemd-journal - -
+Z /run/log/journal/%m 2755 root systemd-journal - -
--
1.7.9.2

View File

@ -1,119 +0,0 @@
From c3544e8d2c2d870a2aff0944aff4ab7824b9ae6b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 5 Jun 2014 21:35:15 +0200
Subject: [PATCH] umount: modernizations
---
src/core/umount.c | 65 ++++++++++++++++++++++-------------------------------
1 file changed, 27 insertions(+), 38 deletions(-)
diff --git src/core/umount.c src/core/umount.c
index d1258f0..a30f674 100644
--- src/core/umount.c
+++ src/core/umount.c
@@ -61,52 +61,46 @@ static void mount_points_list_free(MountPoint **head) {
}
static int mount_points_list_get(MountPoint **head) {
- FILE *proc_self_mountinfo;
- char *path, *p;
+ _cleanup_fclose_ FILE *proc_self_mountinfo = NULL;
unsigned int i;
- int r;
assert(head);
- if (!(proc_self_mountinfo = fopen("/proc/self/mountinfo", "re")))
+ proc_self_mountinfo = fopen("/proc/self/mountinfo", "re");
+ if (!proc_self_mountinfo)
return -errno;
for (i = 1;; i++) {
- int k;
+ _cleanup_free_ char *path = NULL;
+ char *p = NULL;
MountPoint *m;
+ int k;
- path = p = NULL;
-
- if ((k = fscanf(proc_self_mountinfo,
- "%*s " /* (1) mount id */
- "%*s " /* (2) parent id */
- "%*s " /* (3) major:minor */
- "%*s " /* (4) root */
- "%ms " /* (5) mount point */
- "%*s" /* (6) mount options */
- "%*[^-]" /* (7) optional fields */
- "- " /* (8) separator */
- "%*s " /* (9) file system type */
- "%*s" /* (10) mount source */
- "%*s" /* (11) mount options 2 */
- "%*[^\n]", /* some rubbish at the end */
- &path)) != 1) {
+ k = fscanf(proc_self_mountinfo,
+ "%*s " /* (1) mount id */
+ "%*s " /* (2) parent id */
+ "%*s " /* (3) major:minor */
+ "%*s " /* (4) root */
+ "%ms " /* (5) mount point */
+ "%*s" /* (6) mount options */
+ "%*[^-]" /* (7) optional fields */
+ "- " /* (8) separator */
+ "%*s " /* (9) file system type */
+ "%*s" /* (10) mount source */
+ "%*s" /* (11) mount options 2 */
+ "%*[^\n]", /* some rubbish at the end */
+ &path);
+ if (k != 1) {
if (k == EOF)
break;
log_warning("Failed to parse /proc/self/mountinfo:%u.", i);
-
- free(path);
continue;
}
p = cunescape(path);
- free(path);
-
- if (!p) {
- r = -ENOMEM;
- goto finish;
- }
+ if (!p)
+ return -ENOMEM;
/* Ignore mount points we can't unmount because they
* are API or because we are keeping them open (like
@@ -118,22 +112,17 @@ static int mount_points_list_get(MountPoint **head) {
continue;
}
- if (!(m = new0(MountPoint, 1))) {
+ m = new0(MountPoint, 1);
+ if (!m) {
free(p);
- r = -ENOMEM;
- goto finish;
+ return -ENOMEM;
}
m->path = p;
LIST_PREPEND(mount_point, *head, m);
}
- r = 0;
-
-finish:
- fclose(proc_self_mountinfo);
-
- return r;
+ return 0;
}
static int swap_list_get(MountPoint **head) {
--
1.7.9.2

View File

@ -1,126 +0,0 @@
From a4a878d04045b46fa9783664e3643a890b356790 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 11 Jun 2014 11:33:02 +0200
Subject: [PATCH] units: introduce network-pre.target as place to hook in
firewalls
network-pre.target is a passive target that should be pulled in by
services that want to be executed before any network is configured (for
example: firewall scrips).
network-pre.target should be ordered before all network managemet
services (but not be pulled in by them).
network-pre.target should be order after all services that want to be
executed before any network is configured (and be pulled in by them).
---
Makefile.am | 1 +
man/systemd.special.xml | 15 +++++++++++++++
units/local-fs.target | 2 --
units/network-pre.target | 12 ++++++++++++
units/network.target | 2 ++
units/systemd-networkd.service.in | 2 +-
6 files changed, 31 insertions(+), 3 deletions(-)
create mode 100644 units/network-pre.target
diff --git Makefile.am Makefile.am
index 3ea95e9..8514ec9 100644
--- Makefile.am
+++ Makefile.am
@@ -413,6 +413,7 @@ dist_systemunit_DATA = \
units/remote-fs.target \
units/remote-fs-pre.target \
units/network.target \
+ units/network-pre.target \
units/network-online.target \
units/nss-lookup.target \
units/nss-user-lookup.target \
diff --git man/systemd.special.xml man/systemd.special.xml
index 38b94a7..cda6edd 100644
--- man/systemd.special.xml
+++ man/systemd.special.xml
@@ -72,6 +72,7 @@
<filename>multi-user.target</filename>,
<filename>network.target</filename>,
<filename>network-online.target</filename>,
+ <filename>network-pre.target</filename>,
<filename>nss-lookup.target</filename>,
<filename>nss-user-lookup.target</filename>,
<filename>paths.target</filename>,
@@ -891,6 +892,20 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><filename>network-pre.target</filename></term>
+ <listitem>
+ <para>This passive target unit
+ may be pulled in by services
+ that want to run before any
+ network is set up, for example
+ for the purpose of setting up a
+ firewall. All network
+ management software orders
+ itself after this target, but
+ does not pull it in.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><filename>nss-lookup.target</filename></term>
<listitem>
<para>A target that should be
diff --git units/local-fs.target units/local-fs.target
index ae3cedc..70cb13f 100644
--- units/local-fs.target
+++ units/local-fs.target
@@ -9,7 +9,5 @@
Description=Local File Systems
Documentation=man:systemd.special(7)
After=local-fs-pre.target
-DefaultDependencies=no
-Conflicts=shutdown.target
OnFailure=emergency.target
OnFailureJobMode=replace-irreversibly
diff --git units/network-pre.target units/network-pre.target
new file mode 100644
index 0000000..0ea4bc7
--- /dev/null
+++ units/network-pre.target
@@ -0,0 +1,12 @@
+# This file is part of systemd.
+#
+# 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.
+
+[Unit]
+Description=Network (Pre)
+Documentation=man:systemd.special(7)
+Documentation=http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
+RefuseManualStart=yes
diff --git units/network.target units/network.target
index 65fc64b..61ebdca 100644
--- units/network.target
+++ units/network.target
@@ -9,3 +9,5 @@
Description=Network
Documentation=man:systemd.special(7)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
+After=network-pre.target
+RefuseManualStart=yes
diff --git units/systemd-networkd.service.in units/systemd-networkd.service.in
index 373ac4e..48f4d63 100644
--- units/systemd-networkd.service.in
+++ units/systemd-networkd.service.in
@@ -9,7 +9,7 @@
Description=Network Service
Documentation=man:systemd-networkd.service(8)
DefaultDependencies=no
-After=dbus.service
+After=dbus.service network-pre.target
Before=network.target
Wants=network.target
ConditionCapability=CAP_NET_ADMIN
--
1.7.9.2

View File

@ -1,46 +0,0 @@
Based on d3381512282f2ca1c7669f77fb736a90fdce6982 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Tue, 8 Jul 2014 17:42:23 +0200
Subject: [PATCH] units: make ExecStopPost action part of ExecStart
Currently after exiting rescue shell we isolate default target. User
might want to isolate to some other target than default one. However
issuing systemctl isolate command to desired target would bring system
to default target as a consequence of running ExecStopPost action.
Having common ancestor for rescue shell and possible followup systemctl
default command should fix this. If user exits rescue shell we will
proceed with isolating default target, otherwise, on manual isolate,
parent shell process is terminated and we don't isolate default target,
but target chosen by user.
Suggested-by: Michal Schmidt <mschmidt@redhat.com>
---
units/emergency.service.in | 3 +--
units/rescue.service.m4.in | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
--- units/emergency.service.in
+++ units/emergency.service.in 2014-07-10 13:31:50.662235825 +0000
@@ -18,8 +18,7 @@ WorkingDirectory=/root
ExecStartPre=-/usr/bin/plymouth quit
ExecStartPre=-/usr/bin/plymouth --wait
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again\\nto boot into default mode.'
-ExecStart=-/usr/sbin/sulogin
-ExecStopPost=@SYSTEMCTL@ --fail --no-block default
+ExecStart=-/bin/sh -c "/usr/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
Type=idle
StandardInput=tty-force
StandardOutput=inherit
--- units/rescue.service.m4.in
+++ units/rescue.service.m4.in 2014-07-10 13:32:15.678235509 +0000
@@ -19,8 +19,7 @@ WorkingDirectory=/root
ExecStartPre=-/usr/bin/plymouth quit
ExecStartPre=-/usr/bin/plymouth --wait
ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.'
-ExecStart=-/usr/sbin/sulogin
-ExecStopPost=-@SYSTEMCTL@ --fail --no-block default
+ExecStart=-/bin/sh -c "/usr/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
Type=idle
StandardInput=tty-force
StandardOutput=inherit

View File

@ -1,32 +0,0 @@
Based on 812bd1e6ab4c463507557f2bdbb8875fedd92ade Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 21 Nov 2014 01:20:57 +0100
Subject: [PATCH] units: make sure rfkill service is bount to the actual
hardware
---
rules/99-systemd.rules.in | 2 +-
units/systemd-rfkill@.service.in | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
--- rules/99-systemd.rules.in
+++ rules/99-systemd.rules.in
@@ -62,7 +62,7 @@ SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", TAG+="systemd", IMPORT{builtin}="pa
# Pull in rfkill save/restore for all rfkill devices
-SUBSYSTEM=="rfkill", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-rfkill@$name.service"
+SUBSYSTEM=="rfkill", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_ALIAS}+="/sys/subsystem/rfkill/devices/%k", ENV{SYSTEMD_WANTS}+="systemd-rfkill@$name.service"
# Asynchronously mount file systems implemented by these modules as
# soon as they are loaded.
--- units/systemd-rfkill@.service.in
+++ units/systemd-rfkill@.service.in 2014-12-05 11:52:59.433518948 +0000
@@ -9,6 +9,7 @@
Description=Load/Save RF Kill Switch Status of %I
Documentation=man:systemd-rfkill@.service(8)
DefaultDependencies=no
+BindsTo=sys-subsystem-rfkill-devices-%i.device
RequiresMountsFor=/var/lib/systemd/rfkill
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service

View File

@ -1,20 +0,0 @@
Based on 58e027023b47b32e42cf93dd4a629b869ee1ef25 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 11 Jun 2014 14:58:32 +0200
Subject: [PATCH] units: order network-online.target after network.target
There might be implementations around where the network-online logic
might not talk to any network configuration service (and thus not have
to wait for it), hence let's explicitly order network-online.target
after network.target to avoid any ambiguities.
---
units/network-online.target | 1 +
1 file changed, 1 insertion(+)
--- units/network-online.target
+++ units/network-online.target 2014-06-26 00:00:00.000000000 +0000
@@ -9,3 +9,4 @@
Description=Network is Online
Documentation=man:systemd.special(7)
Documentation=http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
+After=network.target

View File

@ -1,29 +0,0 @@
Based on 0b73eab7a2185ae0377650e3fdb8208347a8a575 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
Date: Sat, 23 Mar 2013 03:54:16 +0100
Subject: [PATCH] units/systemd-sysctl.service.in: run after load-modules
Modules might or will register new sysctl options.
[zj: This mechanism of adding modules just to reliably set sysctl
attributes is not ideal. Nevertheless, sysctl for dynamically created
attributes is simply broken, and this is the easiest workaround.]
https://bugzilla.redhat.com/show_bug.cgi?id=1022977
https://bugzilla.novell.com/show_bug.cgi?id=725412
---
units/systemd-sysctl.service.in | 1 +
1 file changed, 1 insertion(+)
diff --git units/systemd-sysctl.service.in units/systemd-sysctl.service.in
index 5c7c5d7..ade9dc3 100644
--- units/systemd-sysctl.service.in
+++ units/systemd-sysctl.service.in
@@ -11,6 +11,7 @@ Documentation=man:systemd-sysctl.service
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
+After=systemd-modules-load.service
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/proc/sys/
ConditionDirectoryNotEmpty=|/lib/sysctl.d

View File

@ -1,24 +0,0 @@
From 8c94052ee543c3598a3c7b0c46688150aa2c6168 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Mon, 27 Oct 2014 17:15:42 +0100
Subject: [PATCH 1/2] units: tmpfiles-setup-dev - allow unsafe file creation to
happen in /dev at boot
This will allow us to mark static device nodes with '!' to indicate that they should only be created at early boot.
---
units/systemd-tmpfiles-setup-dev.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/units/systemd-tmpfiles-setup-dev.service.in b/units/systemd-tmpfiles-setup-dev.service.in
index f3833fd..0123a03 100644
--- a/units/systemd-tmpfiles-setup-dev.service.in
+++ b/units/systemd-tmpfiles-setup-dev.service.in
@@ -17,4 +17,4 @@ ConditionCapability=CAP_SYS_MODULE
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStart=@rootbindir@/systemd-tmpfiles --prefix=/dev --create
+ExecStart=@rootbindir@/systemd-tmpfiles --prefix=/dev --create --boot
--
2.1.2

View File

@ -1,54 +0,0 @@
From 3a8a916338d8446b938f3cf40f6aae0c611892e3 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 7 Jul 2014 11:47:10 +0200
Subject: [PATCH] util: consider 0x7F a control chracter (which it is: DEL)
Let's better be safe than sorry.
---
src/shared/util.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git src/shared/util.c src/shared/util.c
index 3d875c7..d25ee66 100644
--- src/shared/util.c
+++ src/shared/util.c
@@ -1608,8 +1608,9 @@ int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) {
return -ETIMEDOUT;
}
+ errno = 0;
if (!fgets(line, sizeof(line), f))
- return -EIO;
+ return errno ? -errno : -EIO;
truncate_nl(line);
@@ -5355,6 +5356,9 @@ bool string_is_safe(const char *p) {
if (*t > 0 && *t < ' ')
return false;
+ if (*t == 127)
+ return false;
+
if (strchr("\\\"\'", *t))
return false;
}
@@ -5371,10 +5375,14 @@ bool string_has_cc(const char *p) {
assert(p);
- for (t = p; *t; t++)
+ for (t = p; *t; t++) {
if (*t > 0 && *t < ' ' && *t != '\t')
return true;
+ if (*t == 127)
+ return true;
+ }
+
return false;
}
--
1.7.9.2

View File

@ -1,56 +0,0 @@
From ff452e76e2c0f89a32542b7179bb2fd538335933 Mon Sep 17 00:00:00 2001
From: Carl Schaefer <schaefer@trilug.org>
Date: Mon, 23 Jun 2014 18:23:48 +0200
Subject: [PATCH] vconsole: also copy character maps (not just fonts) from vt1
to vt2, vt3, ...
https://bugs.freedesktop.org/show_bug.cgi?id=78796
---
src/vconsole/vconsole-setup.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git src/vconsole/vconsole-setup.c src/vconsole/vconsole-setup.c
index 0f2b706..e0c4050 100644
--- src/vconsole/vconsole-setup.c
+++ src/vconsole/vconsole-setup.c
@@ -180,6 +180,10 @@ static int font_load(const char *vc, const char *font, const char *map, const ch
*/
static void font_copy_to_all_vcs(int fd) {
struct vt_stat vcs = {};
+ unsigned char map8[E_TABSZ];
+ unsigned short map16[E_TABSZ];
+ struct unimapdesc unimapd;
+ struct unipair unipairs[USHRT_MAX];
int i, r;
/* get active, and 16 bit mask of used VT numbers */
@@ -209,6 +213,26 @@ static void font_copy_to_all_vcs(int fd) {
cfo.op = KD_FONT_OP_COPY;
cfo.height = vcs.v_active-1; /* tty1 == index 0 */
ioctl(vcfd, KDFONTOP, &cfo);
+
+ /* copy map of 8bit chars */
+ if (ioctl(fd, GIO_SCRNMAP, map8) >= 0)
+ ioctl(vcfd, PIO_SCRNMAP, map8);
+
+ /* copy map of 8bit chars -> 16bit Unicode values */
+ if (ioctl(fd, GIO_UNISCRNMAP, map16) >= 0)
+ ioctl(vcfd, PIO_UNISCRNMAP, map16);
+
+ /* copy unicode translation table */
+ /* unimapd is a ushort count and a pointer to an
+ array of struct unipair { ushort, ushort } */
+ unimapd.entries = unipairs;
+ unimapd.entry_ct = USHRT_MAX;
+ if (ioctl(fd, GIO_UNIMAP, &unimapd) >= 0) {
+ struct unimapinit adv = { 0, 0, 0 };
+
+ ioctl(vcfd, PIO_UNIMAPCLR, &adv);
+ ioctl(vcfd, PIO_UNIMAP, &unimapd);
+ }
}
}
--
1.7.9.2

View File

@ -1,25 +0,0 @@
From 893e72da6b27c21b102e1589276e651e9e4f591c Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Tue, 9 Sep 2014 18:14:25 +0200
Subject: [PATCH] virt: detect that we are running inside the docker container
---
src/shared/virt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git src/shared/virt.c src/shared/virt.c
index b436895..f9c4e67 100644
--- src/shared/virt.c
+++ src/shared/virt.c
@@ -310,6 +310,8 @@ int detect_container(const char **id) {
_id = "lxc-libvirt";
else if (streq(e, "systemd-nspawn"))
_id = "systemd-nspawn";
+ else if (streq(e, "docker"))
+ _id = "docker";
else
_id = "other";
--
1.7.9.2

View File

@ -1,159 +0,0 @@
Based on fdd25311706bd32580ec4d43211cdf4665d2f9de Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 28 May 2014 18:37:11 +0800
Subject: [PATCH] virt: rework container detection logic
Instead of accessing /proc/1/environ directly, trying to read the
$container variable from it, let's make PID 1 save the contents of that
variable to /run/systemd/container. This allows us to detect containers
without the need for CAP_SYS_PTRACE, which allows us to drop it from a
number of daemons and from the file capabilities of systemd-detect-virt.
Also, don't consider chroot a container technology anymore. After all,
we don't consider file system namespaces container technology anymore,
and hence chroot() should be considered a container even less.
---
Makefile.am | 3 ---
configure.ac | 2 --
src/core/main.c | 12 ++++++++++++
src/shared/virt.c | 48 ++++++++++++++++++++++++++++++------------------
4 files changed, 42 insertions(+), 23 deletions(-)
diff --git Makefile.am Makefile.am
index 5b26bc3..f66ef42 100644
--- Makefile.am
+++ Makefile.am
@@ -1798,9 +1798,6 @@ systemd_detect_virt_SOURCES = \
systemd_detect_virt_LDADD = \
libsystemd-shared.la
-systemd-detect-virt-install-hook:
- -$(SETCAP) cap_dac_override,cap_sys_ptrace=ep $(DESTDIR)$(bindir)/systemd-detect-virt
-
INSTALL_EXEC_HOOKS += \
systemd-detect-virt-install-hook
--- configure.ac
+++ configure.ac 2014-06-03 14:16:45.046237826 +0000
@@ -68,8 +68,6 @@ AC_PATH_PROG([XSLTPROC], [xsltproc])
AC_PATH_PROG([QUOTAON], [quotaon], [/usr/sbin/quotaon])
AC_PATH_PROG([QUOTACHECK], [quotacheck], [/usr/sbin/quotacheck])
-AC_PATH_PROG([SETCAP], [setcap], [/usr/sbin/setcap])
-
AC_PATH_PROG([KILL], [kill], [/usr/bin/kill])
AC_PATH_PROG([KMOD], [kmod], [/usr/bin/kmod])
diff --git src/core/main.c src/core/main.c
index 77cc2fb..d5d1ee2 100644
--- src/core/main.c
+++ src/core/main.c
@@ -1261,6 +1261,16 @@ static int status_welcome(void) {
isempty(pretty_name) ? "Linux" : pretty_name);
}
+static int write_container_id(void) {
+ const char *c;
+
+ c = getenv("container");
+ if (isempty(c))
+ return 0;
+
+ return write_string_file("/run/systemd/container", c);
+}
+
int main(int argc, char *argv[]) {
Manager *m = NULL;
int r, retval = EXIT_FAILURE;
@@ -1544,6 +1554,8 @@ int main(int argc, char *argv[]) {
if (virtualization)
log_info("Detected virtualization '%s'.", virtualization);
+ write_container_id();
+
log_info("Detected architecture '%s'.", architecture_to_string(uname_architecture()));
if (in_initrd())
diff --git src/shared/virt.c src/shared/virt.c
index 0db0514..1e227c5 100644
--- src/shared/virt.c
+++ src/shared/virt.c
@@ -217,8 +217,8 @@ int detect_container(const char **id) {
static thread_local int cached_found = -1;
static thread_local const char *cached_id = NULL;
- _cleanup_free_ char *e = NULL;
- const char *_id = NULL;
+ _cleanup_free_ char *m = NULL;
+ const char *_id = NULL, *e = NULL;
int r;
if (_likely_(cached_found >= 0)) {
@@ -229,17 +229,6 @@ int detect_container(const char **id) {
return cached_found;
}
- /* Unfortunately many of these operations require root access
- * in one way or another */
-
- r = running_in_chroot();
- if (r < 0)
- return r;
- if (r > 0) {
- _id = "chroot";
- goto finish;
- }
-
/* /proc/vz exists in container and outside of the container,
* /proc/bc only outside of the container. */
if (access("/proc/vz", F_OK) >= 0 &&
@@ -249,11 +238,32 @@ int detect_container(const char **id) {
goto finish;
}
- r = getenv_for_pid(1, "container", &e);
- if (r < 0)
- return r;
- if (r == 0)
- goto finish;
+ if (getpid() == 1) {
+ /* If we are PID 1 we can just check our own
+ * environment variable */
+
+ e = getenv("container");
+ if (isempty(e)) {
+ r = 0;
+ goto finish;
+ }
+ } else {
+
+ /* Otherwise, PID 1 dropped this information into a
+ * file in /run. This is better than accessing
+ * /proc/1/environ, since we don't need CAP_SYS_PTRACE
+ * for that. */
+
+ r = read_one_line_file("/run/systemd/container", &m);
+ if (r == -ENOENT) {
+ r = 0;
+ goto finish;
+ }
+ if (r < 0)
+ return r;
+
+ e = m;
+ }
/* We only recognize a selected few here, since we want to
* enforce a redacted namespace */
@@ -266,6 +276,8 @@ int detect_container(const char **id) {
else
_id = "other";
+ r = 1;
+
finish:
cached_found = r;
--
1.7.9.2

View File

@ -1,31 +0,0 @@
From 15f392394e75ffb7f318920008fd1bbe4e82b488 Mon Sep 17 00:00:00 2001
From: Scott Thrasher <scott.thrasher@gmail.com>
Date: Wed, 26 Mar 2014 18:48:13 -0700
Subject: [PATCH] Add hwdb entry for Samsung Series 7 Ultra
---
hwdb/60-keyboard.hwdb | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git hwdb/60-keyboard.hwdb hwdb/60-keyboard.hwdb
index bd8fd10..832c686 100644
--- hwdb/60-keyboard.hwdb
+++ hwdb/60-keyboard.hwdb
@@ -924,6 +924,14 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*90X3A*:pvr*
KEYBOARD_KEY_96=!kbdillumup # Fn+F8 keyboard backlight up
KEYBOARD_KEY_d5=!wlan # Fn+F12 Wi-Fi toggle
+# Series 7 Ultra
+keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*7[34]0U3E*:pvr*
+ KEYBOARD_KEY_ce=!prog1 # Fn+F1 launch settings
+ KEYBOARD_KEY_97=!kbdillumdown # Fn+F9 keyboard backlight down
+ KEYBOARD_KEY_96=!kbdillumup # Fn+F10 keyboard backlight up
+ KEYBOARD_KEY_b3=!prog3 # Fn+F11 fan/cooling mode changer
+ KEYBOARD_KEY_d5=!wlan # Fn+F12 wlan/airplane switch
+
# SQ1US
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pnSQ1US:pvr*
KEYBOARD_KEY_d4=menu
--
1.7.9.2

Some files were not shown because too many files have changed in this diff Show More