A System and Service Manager
CentOS Sources
2015-03-05 84b2777aa4d9106ccfb54b69a24e96733254b010
import systemd-208-20.el7
142 files added
4 files modified
6 files renamed
12427 ■■■■■ changed files
SOURCES/0233-units-serial-getty-.service-add-Install-section.patch 4 ●●●● patch | view | raw | blame | history
SOURCES/0234-units-order-network-online.target-after-network.targ.patch 4 ●●●● patch | view | raw | blame | history
SOURCES/0235-util-consider-both-fuse.glusterfs-and-glusterfs-netw.patch 36 ●●●●● patch | view | raw | blame | history
SOURCES/0236-core-make-StopWhenUnneeded-work-in-conjunction-with-.patch 43 ●●●●● patch | view | raw | blame | history
SOURCES/0237-cgroups-agent-down-grade-log-level.patch 41 ●●●●● patch | view | raw | blame | history
SOURCES/0238-random-seed-raise-POOL_SIZE_MIN-constant-to-1024.patch 23 ●●●●● patch | view | raw | blame | history
SOURCES/0239-delta-do-not-use-unicode-chars-in-C-locale.patch 135 ●●●●● patch | view | raw | blame | history
SOURCES/0240-core-print-debug-instead-of-error-message.patch 32 ●●●●● patch | view | raw | blame | history
SOURCES/0241-journald-always-add-syslog-facility-for-messages-com.patch 41 ●●●●● patch | view | raw | blame | history
SOURCES/0242-Introduce-_cleanup_endmntent_.patch 173 ●●●●● patch | view | raw | blame | history
SOURCES/0243-Introduce-_cleanup_fdset_free_.patch 127 ●●●●● patch | view | raw | blame | history
SOURCES/0244-Introduce-udev-object-cleanup-functions.patch 1291 ●●●●● patch | view | raw | blame | history
SOURCES/0245-fsck-modernization.patch 140 ●●●●● patch | view | raw | blame | history
SOURCES/0246-fsck-fstab-generator-be-lenient-about-missing-fsck.-.patch 212 ●●●●● patch | view | raw | blame | history
SOURCES/0247-rules-60-persistent-storage-add-nvme-pcie-ssd-scsi_i.patch 24 ●●●●● patch | view | raw | blame | history
SOURCES/0248-cgls-fix-running-with-M-option.patch 166 ●●●●● patch | view | raw | blame | history
SOURCES/0249-units-when-spawning-a-getty-configure-TERM-explicitl.patch 60 ●●●●● patch | view | raw | blame | history
SOURCES/0250-getty-Start-getty-on-3270-terminals-available-on-Lin.patch 84 ●●●●● patch | view | raw | blame | history
SOURCES/0251-core-Added-support-for-ERRNO-NOTIFY_SOCKET-message-p.patch 126 ●●●●● patch | view | raw | blame | history
SOURCES/0252-service-don-t-accept-negative-ERRNO-notification-mes.patch 25 ●●●●● patch | view | raw | blame | history
SOURCES/0253-socket-add-SocketUser-and-SocketGroup-for-chown-ing-.patch 2 ●●● patch | view | raw | blame | history
SOURCES/0254-selinux-Check-access-vector-for-enable-and-disable-p.patch 83 ●●●●● patch | view | raw | blame | history
SOURCES/0255-systemctl-show-StatusErrno-value-in-systemctl-status.patch 45 ●●●●● patch | view | raw | blame | history
SOURCES/0256-service-flush-status-text-and-errno-values-each-time.patch 30 ●●●●● patch | view | raw | blame | history
SOURCES/0257-service-don-t-free-status_text-twice.patch 24 ●●●●● patch | view | raw | blame | history
SOURCES/0258-util-add-files_same-helper-function.patch 71 ●●●●● patch | view | raw | blame | history
SOURCES/0259-systemctl-for-switch-root-check-if-we-switch-to-a-sy.patch 109 ●●●●● patch | view | raw | blame | history
SOURCES/0260-shared-include-root-when-canonicalizing-conf-paths.patch 197 ●●●●● patch | view | raw | blame | history
SOURCES/0261-shared-add-root-argument-to-search_and_fopen.patch 144 ●●●●● patch | view | raw | blame | history
SOURCES/0262-machine-id-add-root-option-to-operate-on-an-alternat.patch 264 ●●●●● patch | view | raw | blame | history
SOURCES/0263-conf-files-fix-when-for-root-logic.patch 51 ●●●●● patch | view | raw | blame | history
SOURCES/0264-Make-systemctl-root-look-for-files-in-the-proper-pla.patch 341 ●●●●● patch | view | raw | blame | history
SOURCES/0265-tmpfiles-fix-memory-leak-of-exclude_prefixes.patch 43 ●●●●● patch | view | raw | blame | history
SOURCES/0266-tmpfiles-add-root-option-to-operate-on-an-alternate-.patch 150 ●●●●● patch | view | raw | blame | history
SOURCES/0267-conf-files-include-root-in-returned-file-paths.patch 89 ●●●●● patch | view | raw | blame | history
SOURCES/0268-install-make-sure-that-root-mode-doesn-t-make-us-con.patch 148 ●●●●● patch | view | raw | blame | history
SOURCES/0269-shared-install-do-not-prefix-created-symlink-with-ro.patch 130 ●●●●● patch | view | raw | blame | history
SOURCES/0270-systemctl-fail-in-the-case-that-no-unit-files-were-f.patch 56 ●●●●● patch | view | raw | blame | history
SOURCES/0271-units-make-ExecStopPost-action-part-of-ExecStart.patch 54 ●●●●● patch | view | raw | blame | history
SOURCES/0272-systemctl-fix-broken-list-unit-files-with-root.patch 40 ●●●●● patch | view | raw | blame | history
SOURCES/0273-machine-id-only-look-into-KVM-uuid-when-we-are-not-r.patch 87 ●●●●● patch | view | raw | blame | history
SOURCES/0274-util-reset-signals-when-we-fork-off-agents.patch 10 ●●●● patch | view | raw | blame | history
SOURCES/0275-util-fix-minimal-race-where-we-might-miss-SIGTERMs-w.patch 25 ●●●●● patch | view | raw | blame | history
SOURCES/0276-udev-do-not-skip-the-execution-of-RUN-when-renaming-.patch 163 ●●●●● patch | view | raw | blame | history
SOURCES/0277-man-mention-System-Administrator-s-Guide-in-systemct.patch 33 ●●●●● patch | view | raw | blame | history
SOURCES/0278-vconsole-also-copy-character-maps-not-just-fonts-fro.patch 57 ●●●●● patch | view | raw | blame | history
SOURCES/0279-vconsole-setup-run-setfont-before-loadkeys.patch 99 ●●●●● patch | view | raw | blame | history
SOURCES/0280-vconsole-setup-fix-inverted-error-messages.patch 38 ●●●●● patch | view | raw | blame | history
SOURCES/0281-localed-consider-an-unset-model-as-a-wildcard.patch 42 ●●●●● patch | view | raw | blame | history
SOURCES/0282-systemd-detect-virt-detect-s390-virtualization.patch 75 ●●●●● patch | view | raw | blame | history
SOURCES/0283-systemctl-unbreak-switchroot.patch 75 ●●●●● patch | view | raw | blame | history
SOURCES/0284-systemd-detect-virt-fix-detect-s390-virtualization.patch 28 ●●●●● patch | view | raw | blame | history
SOURCES/0285-exec-Add-SELinuxContext-configuration-item.patch 180 ●●●●● patch | view | raw | blame | history
SOURCES/0286-exec-Ignore-the-setting-SELinuxContext-if-selinux-is.patch 26 ●●●●● patch | view | raw | blame | history
SOURCES/0287-exec-Add-support-for-ignoring-errors-on-SELinuxConte.patch 70 ●●●●● patch | view | raw | blame | history
SOURCES/0288-core-store-and-expose-SELinuxContext-field-normalize.patch 199 ●●●●● patch | view | raw | blame | history
SOURCES/0289-socket-introduce-SELinuxContextFromNet-option.patch 431 ●●●●● patch | view | raw | blame | history
SOURCES/0290-sysctl-make-prefix-allow-all-kinds-of-sysctl-paths.patch 101 ●●●●● patch | view | raw | blame | history
SOURCES/0291-core-make-sure-to-serialize-jobs-for-all-units.patch 112 ●●●●● patch | view | raw | blame | history
SOURCES/0292-man-mention-localectl-in-locale.conf.patch 35 ●●●●● patch | view | raw | blame | history
SOURCES/0293-rules-automatically-online-hot-added-CPUs.patch 37 ●●●●● patch | view | raw | blame | history
SOURCES/0294-rules-add-rule-for-naming-Dell-iDRAC-USB-Virtual-NIC.patch 41 ●●●●● patch | view | raw | blame | history
SOURCES/0295-bash-completion-add-verb-set-property.patch 54 ●●●●● patch | view | raw | blame | history
SOURCES/0296-man-update-journald-rate-limit-defaults.patch 29 ●●●●● patch | view | raw | blame | history
SOURCES/0297-core-don-t-try-to-connect-to-d-bus-after-switchroot.patch 25 ●●●●● patch | view | raw | blame | history
SOURCES/0298-localed-log-locale-keymap-changes-in-detail.patch 244 ●●●●● patch | view | raw | blame | history
SOURCES/0299-localed-introduce-helper-function-to-simplify-matchi.patch 63 ●●●●● patch | view | raw | blame | history
SOURCES/0300-localed-check-for-partially-matching-converted-keyma.patch 113 ●●●●● patch | view | raw | blame | history
SOURCES/0301-fileio-make-parse_env_file-return-number-of-parsed-i.patch 130 ●●●●● patch | view | raw | blame | history
SOURCES/0302-localectl-print-warning-when-there-are-options-given.patch 292 ●●●●● patch | view | raw | blame | history
SOURCES/0303-dbus-fix-crash-when-appending-selinux-context.patch 43 ●●●●● patch | view | raw | blame | history
SOURCES/0304-tmpfiles-minor-modernizations.patch 66 ●●●●● patch | view | raw | blame | history
SOURCES/0305-install-when-looking-for-a-unit-file-for-enabling-se.patch 126 ●●●●● patch | view | raw | blame | history
SOURCES/0306-install-remove-unused-variable.patch 25 ●●●●● patch | view | raw | blame | history
SOURCES/0307-bootctl-typo-fix-in-help-message.patch 25 ●●●●● patch | view | raw | blame | history
SOURCES/0308-logind-ignore-failing-close-on-session-devices.patch 59 ●●●●● patch | view | raw | blame | history
SOURCES/0309-sysfs-show.c-return-negative-error.patch 27 ●●●●● patch | view | raw | blame | history
SOURCES/0310-core-only-send-SIGHUP-when-doing-first-kill-not-when.patch 61 ●●●●● patch | view | raw | blame | history
SOURCES/0311-cgroup-make-sure-to-properly-send-SIGCONT-to-all-pro.patch 33 ●●●●● patch | view | raw | blame | history
SOURCES/0312-core-don-t-send-duplicate-SIGCONT-when-killing-units.patch 25 ●●●●● patch | view | raw | blame | history
SOURCES/0313-efi-fix-Undefined-reference-efi_loader_get_boot_usec.patch 28 ●●●●● patch | view | raw | blame | history
SOURCES/0314-macro-better-make-IN_SET-macro-use-const-arrays.patch 38 ●●●●● patch | view | raw | blame | history
SOURCES/0315-macro-make-sure-we-can-use-IN_SET-also-with-complex-.patch 49 ●●●●● patch | view | raw | blame | history
SOURCES/0316-core-fix-property-changes-in-transient-units.patch 93 ●●●●● patch | view | raw | blame | history
SOURCES/0317-load-modules-properly-return-a-failing-error-code-if.patch 34 ●●●●● patch | view | raw | blame | history
SOURCES/0318-core-unit-fix-unit_add_target_dependencies-for-units.patch 34 ●●●●● patch | view | raw | blame | history
SOURCES/0319-man-there-is-no-ExecStopPre-for-service-units.patch 27 ●●●●● patch | view | raw | blame | history
SOURCES/0320-man-document-that-per-interface-sysctl-variables-are.patch 36 ●●●●● patch | view | raw | blame | history
SOURCES/0321-journal-downgrade-vaccuum-message-to-debug-level.patch 27 ●●●●● patch | view | raw | blame | history
SOURCES/0322-logs-show-fix-corrupt-output-with-empty-messages.patch 42 ●●●●● patch | view | raw | blame | history
SOURCES/0323-journalctl-refuse-extra-arguments-with-verify-and-si.patch 31 ●●●●● patch | view | raw | blame | history
SOURCES/0324-journal-assume-that-next-entry-is-after-previous-ent.patch 71 ●●●●● patch | view | raw | blame | history
SOURCES/0325-journal-forget-file-after-encountering-an-error.patch 75 ●●●●● patch | view | raw | blame | history
SOURCES/0326-man-update-link-to-LSB.patch 36 ●●●●● patch | view | raw | blame | history
SOURCES/0327-man-systemd-bootchart-fix-spacing-in-command.patch 29 ●●●●● patch | view | raw | blame | history
SOURCES/0328-man-add-missing-comma.patch 27 ●●●●● patch | view | raw | blame | history
SOURCES/0329-units-Do-not-unescape-instance-name-in-systemd-backl.patch 39 ●●●●● patch | view | raw | blame | history
SOURCES/0330-manager-flush-memory-stream-before-using-the-buffer.patch 75 ●●●●● patch | view | raw | blame | history
SOURCES/0331-man-multiple-sleep-modes-are-to-be-separated-by-whit.patch 63 ●●●●● patch | view | raw | blame | history
SOURCES/0332-man-fix-description-of-systemctl-after-before.patch 30 ●●●●● patch | view | raw | blame | history
SOURCES/0333-udev-properly-detect-reference-to-unexisting-part-of.patch 26 ●●●●● patch | view | raw | blame | history
SOURCES/0334-gpt-auto-generator-don-t-return-OOM-on-parentless-de.patch 25 ●●●●● patch | view | raw | blame | history
SOURCES/0335-man-improve-wording-of-systemctl-s-after-before.patch 57 ●●●●● patch | view | raw | blame | history
SOURCES/0336-cgroup-it-s-not-OK-to-invoke-alloca-in-loops.patch 80 ●●●●● patch | view | raw | blame | history
SOURCES/0337-core-don-t-try-to-relabel-mounts-before-we-loaded-th.patch 28 ●●●●● patch | view | raw | blame | history
SOURCES/0338-systemctl-kill-mode-is-long-long-gone-don-t-mention-.patch 53 ●●●●● patch | view | raw | blame | history
SOURCES/0339-ask-password-when-the-user-types-a-overly-long-passw.patch 34 ●●●●● patch | view | raw | blame | history
SOURCES/0340-logind-don-t-print-error-if-devices-vanish-during-AC.patch 39 ●●●●● patch | view | raw | blame | history
SOURCES/0341-tty-ask-password-agent-return-negative-errno.patch 30 ●●●●● patch | view | raw | blame | history
SOURCES/0342-journal-cleanup-up-error-handling-in-update_catalog.patch 105 ●●●●● patch | view | raw | blame | history
SOURCES/0343-bash-completion-fix-__get_startable_units.patch 25 ●●●●● patch | view | raw | blame | history
SOURCES/0344-core-check-the-right-variable-for-failed-open.patch 25 ●●●●● patch | view | raw | blame | history
SOURCES/0345-util-allow-trailing-semicolons-on-define_trivial_cle.patch 209 ●●●●● patch | view | raw | blame | history
SOURCES/0346-man-sd_journal_send-does-nothing-when-journald-is-no.patch 31 ●●●●● patch | view | raw | blame | history
SOURCES/0347-man-clarify-that-the-ExecReload-command-should-be-sy.patch 40 ●●●●● patch | view | raw | blame | history
SOURCES/0348-conf-parser-never-consider-it-an-error-if-we-cannot-.patch 30 ●●●●● patch | view | raw | blame | history
SOURCES/0349-socket-properly-handle-if-our-service-vanished-durin.patch 30 ●●●●● patch | view | raw | blame | history
SOURCES/0350-Do-not-unescape-unit-names-in-Install-section.patch 27 ●●●●● patch | view | raw | blame | history
SOURCES/0351-util-ignore_file-should-not-allow-files-ending-with.patch 29 ●●●●● patch | view | raw | blame | history
SOURCES/0352-core-fix-invalid-free-in-killall.patch 33 ●●●●● patch | view | raw | blame | history
SOURCES/0353-install-fix-invalid-free-in-unit_file_mask.patch 31 ●●●●● patch | view | raw | blame | history
SOURCES/0354-unit-name-fix-detection-of-unit-templates-instances.patch 59 ●●●●● patch | view | raw | blame | history
SOURCES/0355-journald-make-MaxFileSec-really-default-to-1month.patch 36 ●●●●● patch | view | raw | blame | history
SOURCES/0356-bootchart-it-s-not-OK-to-return-1-from-a-main-progra.patch 27 ●●●●● patch | view | raw | blame | history
SOURCES/0357-journald-Fix-off-by-one-error-in-Missed-X-kernel-mes.patch 30 ●●●●● patch | view | raw | blame | history
SOURCES/0358-man-drop-references-to-removed-and-obsolete-systemct.patch 37 ●●●●● patch | view | raw | blame | history
SOURCES/0359-units-fix-BindsTo-logic-when-applied-relative-to-ser.patch 94 ●●●●● patch | view | raw | blame | history
SOURCES/0360-core-don-t-allow-enabling-if-unit-is-masked.patch 36 ●●●●● patch | view | raw | blame | history
SOURCES/0361-man-systemctl-document-enable-on-masked-units.patch 35 ●●●●● patch | view | raw | blame | history
SOURCES/0362-core-do-not-segfault-if-proc-swaps-cannot-be-opened.patch 54 ●●●●● patch | view | raw | blame | history
SOURCES/0363-man-we-don-t-have-Wanted-dependency.patch 29 ●●●●● patch | view | raw | blame | history
SOURCES/0364-environment-append-unit_id-to-error-messages-regardi.patch 132 ●●●●● patch | view | raw | blame | history
SOURCES/0365-udevd-add-event-timeout-commandline-option.patch 125 ●●●●● patch | view | raw | blame | history
SOURCES/0366-selinux-fix-potential-double-free-crash-in-child-pro.patch 40 ●●●●● patch | view | raw | blame | history
SOURCES/0367-selinux-pass-flag-to-correct-exec_spawn.patch 42 ●●●●● patch | view | raw | blame | history
SOURCES/0368-selinux-set-selinux-context-applied-on-exec-before-c.patch 89 ●●●●● patch | view | raw | blame | history
SOURCES/0369-logind-use-correct-who-enum-values-with-KillUnit.patch 43 ●●●●● patch | view | raw | blame | history
SOURCES/0370-logind-always-kill-session-when-termination-is-reque.patch 291 ●●●●● patch | view | raw | blame | history
SOURCES/0371-udev-net_id-correctly-name-netdevs-based-on-dev_port.patch 49 ●●●●● patch | view | raw | blame | history
SOURCES/0372-udev-net_id-dev_port-is-base-10.patch 23 ●●●●● patch | view | raw | blame | history
SOURCES/0373-udev-Fix-parsing-of-udev.event-timeout-kernel-parame.patch 25 ●●●●● patch | view | raw | blame | history
SOURCES/0374-login-rerun-vconsole-setup-when-switching-from-vgaco.patch 61 ●●●●● patch | view | raw | blame | history
SOURCES/0375-cgroups-agent-really-down-grade-log-level.patch 29 ●●●●● patch | view | raw | blame | history
SOURCES/0376-core-introduce-new-Delegate-yes-no-property-controll.patch 58 ●●●● patch | view | raw | blame | history
SOURCES/0377-core-don-t-migrate-PIDs-for-units-that-may-contain-s.patch 6 ●●●● patch | view | raw | blame | history
SOURCES/0378-mount-use-libmount-to-enumerate-proc-self-mountinfo.patch 204 ●●●●● patch | view | raw | blame | history
SOURCES/0379-mount-monitor-for-utab-changes-with-inotify.patch 209 ●●●●● patch | view | raw | blame | history
SOURCES/0380-mount-add-remote-fs-dependencies-if-needed-after-cha.patch 44 ●●●●● patch | view | raw | blame | history
SOURCES/0381-mount-check-options-as-well-as-fstype-for-network-mo.patch 87 ●●●●● patch | view | raw | blame | history
SOURCES/0382-rules-don-t-enable-usb-pm-for-Avocent-devices.patch 4 ●●●● patch | view | raw | blame | history
SOURCES/rc.local 4 ●●●● patch | view | raw | blame | history
SPECS/systemd.spec 292 ●●●●● patch | view | raw | blame | history
SOURCES/0233-units-serial-getty-.service-add-Install-section.patch
@@ -1,4 +1,4 @@
From 2e1c925693871dfba76845b82bb653dc09b2de97 Mon Sep 17 00:00:00 2001
From 8ade7cd519f3cdccc81ed8c2fb2f72df48a191d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 24 Feb 2014 08:02:28 -0500
Subject: [PATCH] units/serial-getty@.service: add [Install] section
@@ -8,7 +8,7 @@
http://lists.freedesktop.org/archives/systemd-devel/2014-February/017329.html
Resolves: #1118230
Resolves: #1083936
---
 units/serial-getty@.service.m4 | 3 +++
 1 file changed, 3 insertions(+)
SOURCES/0234-units-order-network-online.target-after-network.targ.patch
@@ -1,9 +1,9 @@
From 8ace570670d71d13fe604e7cf9d264de245ac981 Mon Sep 17 00:00:00 2001
From dda9057e8ee63f2e525333bf7d606f22bce0f7f5 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Mon, 21 Jul 2014 15:13:15 +0200
Subject: [PATCH] units: order network-online.target after network.target
Resolves: #1121650
Resolves: #1072431
---
 units/network-online.target | 1 +
 1 file changed, 1 insertion(+)
SOURCES/0235-util-consider-both-fuse.glusterfs-and-glusterfs-netw.patch
New file
@@ -0,0 +1,36 @@
From f8615ebc34fb1a960a1bd946650a8c15a9a347fa Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 25 Mar 2014 01:46:24 +0100
Subject: [PATCH] util: consider both fuse.glusterfs and glusterfs network file
 systems
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Based on a similar patch by Lukáš Nykrýn.
Resolves: #1080229
---
 src/shared/util.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index 090a204..2974c2a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1625,7 +1625,14 @@ bool fstype_is_network(const char *fstype) {
                 "nfs\0"
                 "nfs4\0"
                 "gfs\0"
-                "gfs2\0";
+                "gfs2\0"
+                "glusterfs\0";
+
+        const char *x;
+
+        x = startswith(fstype, "fuse.");
+        if (x)
+                fstype = x;
         return nulstr_contains(table, fstype);
 }
SOURCES/0236-core-make-StopWhenUnneeded-work-in-conjunction-with-.patch
New file
@@ -0,0 +1,43 @@
From bb586b571661bd77cafe0824efecdba502c99a98 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 13 Feb 2014 02:12:27 +0100
Subject: [PATCH] core: make StopWhenUnneeded work in conjunction with units
 that fail during their start job
https://bugzilla.redhat.com/show_bug.cgi?id=997031
Resolves: #986949
---
 src/core/unit.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/core/unit.c b/src/core/unit.c
index a4e6c18..17792d1 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1455,7 +1455,9 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
          * sucessfully, since there's no change of state in that case. Which is
          * why it is handled in service_set_state() */
         if (UNIT_IS_INACTIVE_OR_FAILED(os) != UNIT_IS_INACTIVE_OR_FAILED(ns)) {
-                ExecContext *ec = unit_get_exec_context(u);
+                ExecContext *ec;
+
+                ec = unit_get_exec_context(u);
                 if (ec && exec_context_may_touch_console(ec)) {
                         if (UNIT_IS_INACTIVE_OR_FAILED(ns)) {
                                 m->n_on_console --;
@@ -1551,12 +1553,11 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
                 }
                 /* stop unneeded units regardless if going down was expected or not */
-                if (UNIT_IS_ACTIVE_OR_ACTIVATING(os) && UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
+                if (UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
                         check_unneeded_dependencies(u);
                 if (ns != os && ns == UNIT_FAILED) {
-                        log_notice_unit(u->id,
-                                        "Unit %s entered failed state.", u->id);
+                        log_notice_unit(u->id, "Unit %s entered failed state.", u->id);
                         unit_start_on_failure(u);
                 }
         }
SOURCES/0237-cgroups-agent-down-grade-log-level.patch
New file
@@ -0,0 +1,41 @@
From b0010d76a8c56900d15fab8ac1ed94d364d1e566 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Wed, 23 Jul 2014 14:08:18 +0200
Subject: [PATCH] cgroups-agent: down-grade log level
(cherry picked from commit 844de4355592259eebcffddfc38c63266e451cb6)
Conflicts:
        src/cgroups-agent/cgroups-agent.c
Resolves: #1044386
---
 src/cgroups-agent/cgroups-agent.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/cgroups-agent/cgroups-agent.c b/src/cgroups-agent/cgroups-agent.c
index a47949a..43b9b3a 100644
--- a/src/cgroups-agent/cgroups-agent.c
+++ b/src/cgroups-agent/cgroups-agent.c
@@ -50,7 +50,11 @@ int main(int argc, char *argv[]) {
         bus = dbus_connection_open_private("unix:path=/run/systemd/private", &error);
         if (!bus) {
-                log_warning("Failed to get D-Bus connection: %s", bus_error_message(&error));
+                log_warning("Failed to get D-Bus connection: %s", strerror(-r));
+                /* If we couldn't connect we assume this was triggered
+                 * while systemd got restarted/transitioned from
+                 * initrd to the system, so let's ignore this */
+                log_debug("Failed to get D-Bus connection: %s", strerror(-r));
                 goto finish;
         }
@@ -73,7 +77,7 @@ int main(int argc, char *argv[]) {
         }
         if (!dbus_connection_send(bus, m, NULL)) {
-                log_error("Failed to send signal message on private connection.");
+                log_debug("Failed to send signal message on private connection.");
                 goto finish;
         }
SOURCES/0238-random-seed-raise-POOL_SIZE_MIN-constant-to-1024.patch
New file
@@ -0,0 +1,23 @@
From 20436a1eb3a468b7bc32fe1d36cb7c4029519052 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 24 Jul 2014 11:17:36 +0200
Subject: [PATCH] random-seed: raise POOL_SIZE_MIN constant to 1024
Resolves: #1066517
---
 src/random-seed/random-seed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c
index af79ecf..8b7bfbb 100644
--- a/src/random-seed/random-seed.c
+++ b/src/random-seed/random-seed.c
@@ -29,7 +29,7 @@
 #include "util.h"
 #include "mkdir.h"
-#define POOL_SIZE_MIN 512
+#define POOL_SIZE_MIN 1024
 int main(int argc, char *argv[]) {
         _cleanup_close_ int seed_fd = -1, random_fd = -1;
SOURCES/0239-delta-do-not-use-unicode-chars-in-C-locale.patch
New file
@@ -0,0 +1,135 @@
From 719f080ce2c999febe4c9289fb09e5e2e719d4d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 16 Apr 2014 23:33:41 -0400
Subject: [PATCH] delta: do not use unicode chars in C locale
https://bugzilla.redhat.com/show_bug.cgi?id=1088418
(cherry picked from commit 00a5cc3a63c125633e822f39efd9c32223169f62)
Resolves: #1088419
---
 src/delta/delta.c | 40 +++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)
diff --git a/src/delta/delta.c b/src/delta/delta.c
index a8dd57e..f1aea80 100644
--- a/src/delta/delta.c
+++ b/src/delta/delta.c
@@ -85,6 +85,10 @@ static void pager_open_if_enabled(void) {
         pager_open(false);
 }
+static inline const char* arrow(void) {
+        return is_locale_utf8() ? "→" : "->";
+}
+
 static int equivalent(const char *a, const char *b) {
         _cleanup_free_ char *x = NULL, *y = NULL;
@@ -103,8 +107,9 @@ static int notify_override_masked(const char *top, const char *bottom) {
         if (!(arg_flags & SHOW_MASKED))
                 return 0;
-        printf("%s%s%s     %s → %s\n",
-               ansi_highlight_red(), "[MASKED]", ansi_highlight_off(), top, bottom);
+        printf("%s%s%s     %s %s %s\n",
+               ansi_highlight_red(), "[MASKED]", ansi_highlight_off(),
+               top, arrow(), bottom);
         return 1;
 }
@@ -112,8 +117,9 @@ static int notify_override_equivalent(const char *top, const char *bottom) {
         if (!(arg_flags & SHOW_EQUIVALENT))
                 return 0;
-        printf("%s%s%s %s → %s\n",
-               ansi_highlight_green(), "[EQUIVALENT]", ansi_highlight_off(), top, bottom);
+        printf("%s%s%s %s %s %s\n",
+               ansi_highlight_green(), "[EQUIVALENT]", ansi_highlight_off(),
+               top, arrow(), bottom);
         return 1;
 }
@@ -121,8 +127,9 @@ static int notify_override_redirected(const char *top, const char *bottom) {
         if (!(arg_flags & SHOW_REDIRECTED))
                 return 0;
-        printf("%s%s%s   %s → %s\n",
-               ansi_highlight(), "[REDIRECTED]", ansi_highlight_off(), top, bottom);
+        printf("%s%s%s   %s %s %s\n",
+               ansi_highlight(), "[REDIRECTED]", ansi_highlight_off(),
+               top, arrow(), bottom);
         return 1;
 }
@@ -130,8 +137,9 @@ static int notify_override_overridden(const char *top, const char *bottom) {
         if (!(arg_flags & SHOW_OVERRIDDEN))
                 return 0;
-        printf("%s%s%s %s → %s\n",
-               ansi_highlight(), "[OVERRIDDEN]", ansi_highlight_off(), top, bottom);
+        printf("%s%s%s %s %s %s\n",
+               ansi_highlight(), "[OVERRIDDEN]", ansi_highlight_off(),
+               top, arrow(), bottom);
         return 1;
 }
@@ -139,8 +147,9 @@ static int notify_override_extended(const char *top, const char *bottom) {
         if (!(arg_flags & SHOW_EXTENDED))
                return 0;
-        printf("%s%s%s   %s → %s\n",
-               ansi_highlight(), "[EXTENDED]", ansi_highlight_off(), top, bottom);
+        printf("%s%s%s   %s %s %s\n",
+               ansi_highlight(), "[EXTENDED]", ansi_highlight_off(),
+               top, arrow(), bottom);
         return 1;
 }
@@ -241,7 +250,7 @@ static int enumerate_dir_d(Hashmap *top, Hashmap *bottom, Hashmap *drops, const
                         return -ENOMEM;
                 d = p + strlen(toppath) + 1;
-                log_debug("Adding at top: %s → %s", d, p);
+                log_debug("Adding at top: %s %s %s", d, arrow(), p);
                 k = hashmap_put(top, d, p);
                 if (k >= 0) {
                         p = strdup(p);
@@ -253,7 +262,7 @@ static int enumerate_dir_d(Hashmap *top, Hashmap *bottom, Hashmap *drops, const
                         return k;
                 }
-                log_debug("Adding at bottom: %s → %s", d, p);
+                log_debug("Adding at bottom: %s %s %s", d, arrow(), p);
                 free(hashmap_remove(bottom, d));
                 k = hashmap_put(bottom, d, p);
                 if (k < 0) {
@@ -276,7 +285,8 @@ static int enumerate_dir_d(Hashmap *top, Hashmap *bottom, Hashmap *drops, const
                 if (!p)
                         return -ENOMEM;
-                log_debug("Adding to drops: %s → %s → %s", unit, basename(p), p);
+                log_debug("Adding to drops: %s %s %s %s %s",
+                          unit, arrow(), basename(p), arrow(), p);
                 k = hashmap_put(h, basename(p), p);
                 if (k < 0) {
                         free(p);
@@ -328,7 +338,7 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, Hashmap *drops, const ch
                 if (!p)
                         return -ENOMEM;
-                log_debug("Adding at top: %s → %s", basename(p), p);
+                log_debug("Adding at top: %s %s %s", basename(p), arrow(), p);
                 k = hashmap_put(top, basename(p), p);
                 if (k >= 0) {
                         p = strdup(p);
@@ -339,7 +349,7 @@ static int enumerate_dir(Hashmap *top, Hashmap *bottom, Hashmap *drops, const ch
                         return k;
                 }
-                log_debug("Adding at bottom: %s → %s", basename(p), p);
+                log_debug("Adding at bottom: %s %s %s", basename(p), arrow(), p);
                 free(hashmap_remove(bottom, basename(p)));
                 k = hashmap_put(bottom, basename(p), p);
                 if (k < 0) {
SOURCES/0240-core-print-debug-instead-of-error-message.patch
New file
@@ -0,0 +1,32 @@
From bcbb894a709f56ac0bccf7e5edfd59e39e8ec800 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 14 May 2014 15:13:43 +0200
Subject: [PATCH] core: print debug instead of error message
In case that session scope is in some other state than SCOPE_RUNNING or
SCOPE_ABANDONED we will not print error message. It might be the case
that scope is in other state because systemd realized that scope is
empty before dispatching dbus call from pam hook. Or system is going
down and stop job is runnig for the scope and changed scope state to
SCOPE_STOP_SIGTERM or SCOPE_STOP_SIGKILL.
(cherry picked from commit f517790db5277fa71d6ae3617244f1acc4b62572)
Resolves: #1105608
---
 src/core/dbus-scope.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c
index 58dd9ff..71d6921 100644
--- a/src/core/dbus-scope.c
+++ b/src/core/dbus-scope.c
@@ -76,7 +76,7 @@ DBusHandlerResult bus_scope_message_handler(Unit *u, DBusConnection *c, DBusMess
                 r = scope_abandon(s);
                 if (r < 0)
-                        log_error("Failed to mark scope %s as abandoned : %s", UNIT(s)->id, strerror(-r));
+                        log_debug("Failed to mark scope %s as abandoned : Scope is not running", UNIT(s)->id);
                 reply = dbus_message_new_method_return(message);
                 if (!reply)
SOURCES/0241-journald-always-add-syslog-facility-for-messages-com.patch
New file
@@ -0,0 +1,41 @@
From 7f85c4184fc45c3dd2c76b4867ab252c3530f84d Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Fri, 25 Jul 2014 14:38:22 +0200
Subject: [PATCH] journald: always add syslog facility for messages coming from
 kmsg
Set SYSLOG_FACILITY field for kernel log messages too. Setting only
SYSLOG_IDENTIFIER="kernel" is not sufficient and tools reading journal
maybe confused by missing SYSLOG_FACILITY field for kernel log messages.
(cherry picked from commit 36dd072cdf03dcac0fcd2d6b42f261444dc7ac88)
Resolves: #1113215
---
 src/journal/journald-kmsg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 9895808..e393cb7 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -274,6 +274,9 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) {
         if (asprintf(&syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK) >= 0)
                 IOVEC_SET_STRING(iovec[n++], syslog_priority);
+        if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0)
+                IOVEC_SET_STRING(iovec[n++], syslog_facility);
+
         if ((priority & LOG_FACMASK) == LOG_KERN)
                 IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel");
         else {
@@ -295,9 +298,6 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) {
                         if (syslog_pid)
                                 IOVEC_SET_STRING(iovec[n++], syslog_pid);
                 }
-
-                if (asprintf(&syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)) >= 0)
-                        IOVEC_SET_STRING(iovec[n++], syslog_facility);
         }
         message = cunescape_length_with_prefix(p, pl, "MESSAGE=");
SOURCES/0242-Introduce-_cleanup_endmntent_.patch
New file
@@ -0,0 +1,173 @@
From 8e7be40d1386e6053d4663114a00e0390400350f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 3 Oct 2013 22:13:55 -0400
Subject: [PATCH] Introduce _cleanup_endmntent_
(cherry picked from commit 5862d652ba14178cff46b8a8fc6c6d8392bf32b1)
Related: #1098310
---
 src/cryptsetup/cryptsetup.c           | 19 ++++++-------------
 src/fstab-generator/fstab-generator.c | 17 +++++------------
 src/remount-fs/remount-fs.c           | 13 ++++---------
 src/shared/util.h                     |  7 +++++++
 4 files changed, 22 insertions(+), 34 deletions(-)
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 769c3e4..4f2f52a 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -236,31 +236,24 @@ finish:
 }
 static char *disk_mount_point(const char *label) {
-        char *mp = NULL;
         _cleanup_free_ char *device = NULL;
-        FILE *f = NULL;
+        _cleanup_endmntent_ FILE *f = NULL;
         struct mntent *m;
         /* Yeah, we don't support native systemd unit files here for now */
         if (asprintf(&device, "/dev/mapper/%s", label) < 0)
-                goto finish;
+                return NULL;
         f = setmntent("/etc/fstab", "r");
         if (!f)
-                goto finish;
+                return NULL;
         while ((m = getmntent(f)))
-                if (path_equal(m->mnt_fsname, device)) {
-                        mp = strdup(m->mnt_dir);
-                        break;
-                }
-
-finish:
-        if (f)
-                endmntent(f);
+                if (path_equal(m->mnt_fsname, device))
+                        return strdup(m->mnt_dir);
-        return mp;
+        return NULL;
 }
 static int get_password(const char *name, usec_t until, bool accept_cached, char ***passwords) {
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index c0c2992..78d7609 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -327,15 +327,12 @@ static int add_mount(
 }
 static int parse_fstab(const char *prefix, bool initrd) {
-        _cleanup_free_ char *fstab_path = NULL;
-        FILE *f;
+        char *fstab_path;
+        _cleanup_endmntent_ FILE *f;
         int r = 0;
         struct mntent *me;
-        fstab_path = strjoin(strempty(prefix), "/etc/fstab", NULL);
-        if (!fstab_path)
-                return log_oom();
-
+        fstab_path = strappenda(strempty(prefix), "/etc/fstab");
         f = setmntent(fstab_path, "r");
         if (!f) {
                 if (errno == ENOENT)
@@ -354,10 +351,8 @@ static int parse_fstab(const char *prefix, bool initrd) {
                 what = fstab_node_to_udev_node(me->mnt_fsname);
                 where = strjoin(strempty(prefix), me->mnt_dir, NULL);
-                if (!what || !where) {
-                        r = log_oom();
-                        goto finish;
-                }
+                if (!what || !where)
+                        return log_oom();
                 if (is_path(where))
                         path_kill_slashes(where);
@@ -395,8 +390,6 @@ static int parse_fstab(const char *prefix, bool initrd) {
                         r = k;
         }
-finish:
-        endmntent(f);
         return r;
 }
diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c
index f432718..847637a 100644
--- a/src/remount-fs/remount-fs.c
+++ b/src/remount-fs/remount-fs.c
@@ -40,7 +40,7 @@
 int main(int argc, char *argv[]) {
         int ret = EXIT_FAILURE;
-        FILE *f = NULL;
+        _cleanup_endmntent_ FILE *f = NULL;
         struct mntent* me;
         Hashmap *pids = NULL;
@@ -57,13 +57,11 @@ int main(int argc, char *argv[]) {
         f = setmntent("/etc/fstab", "r");
         if (!f) {
-                if (errno == ENOENT) {
-                        ret = EXIT_SUCCESS;
-                        goto finish;
-                }
+                if (errno == ENOENT)
+                        return EXIT_SUCCESS;
                 log_error("Failed to open /etc/fstab: %m");
-                goto finish;
+                return EXIT_FAILURE;
         }
         pids = hashmap_new(trivial_hash_func, trivial_compare_func);
@@ -162,8 +160,5 @@ finish:
         if (pids)
                 hashmap_free_free(pids);
-        if (f)
-                endmntent(f);
-
         return ret;
 }
diff --git a/src/shared/util.h b/src/shared/util.h
index 3a4bc98..5a1e1bc 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -39,6 +39,7 @@
 #include <stddef.h>
 #include <unistd.h>
 #include <locale.h>
+#include <mntent.h>
 #include "macro.h"
 #include "time-util.h"
@@ -579,6 +580,11 @@ static inline void umaskp(mode_t *u) {
         umask(*u);
 }
+static inline void endmntentp(FILE **f) {
+        if (*f)
+                endmntent(*f);
+}
+
 #define _cleanup_free_ _cleanup_(freep)
 #define _cleanup_fclose_ _cleanup_(fclosep)
 #define _cleanup_pclose_ _cleanup_(pclosep)
@@ -586,6 +592,7 @@ static inline void umaskp(mode_t *u) {
 #define _cleanup_closedir_ _cleanup_(closedirp)
 #define _cleanup_umask_ _cleanup_(umaskp)
 #define _cleanup_globfree_ _cleanup_(globfree)
+#define _cleanup_endmntent_ _cleanup_(endmntentp)
 _malloc_  _alloc_(1, 2) static inline void *malloc_multiply(size_t a, size_t b) {
         if (_unlikely_(b == 0 || a > ((size_t) -1) / b))
SOURCES/0243-Introduce-_cleanup_fdset_free_.patch
New file
@@ -0,0 +1,127 @@
From 735583e63b9c109e3aaa7aecbce8d7a477988ef6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 11 Oct 2013 19:33:48 -0400
Subject: [PATCH] Introduce _cleanup_fdset_free_
(cherry picked from commit 51d122af23533b0b8318911c4fc8b128ad8eafb7)
Related: #1098310
---
 src/core/manager.c  | 22 +++++++---------------
 src/nspawn/nspawn.c |  4 +---
 src/shared/fdset.h  |  7 +++++++
 3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/src/core/manager.c b/src/core/manager.c
index 2829c95..57a88b0 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -236,7 +236,7 @@ static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned po
                 *p++ = '*';
                 if (pos < width-1)
                         p = mempset(p, ' ', width-1-pos);
-                p = stpcpy(p, ANSI_HIGHLIGHT_OFF);
+                strcpy(p, ANSI_HIGHLIGHT_OFF);
         }
 }
@@ -257,6 +257,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
         /* m->n_running_jobs must be consistent with the contents of m->jobs,
          * so the above loop must have succeeded in finding j. */
         assert(counter == print_nr + 1);
+        assert(j);
         cylon_pos = m->jobs_in_progress_iteration % 14;
         if (cylon_pos >= 8)
@@ -2343,8 +2344,8 @@ int manager_distribute_fds(Manager *m, FDSet *fds) {
 int manager_reload(Manager *m) {
         int r, q;
-        FILE *f;
-        FDSet *fds;
+        _cleanup_fclose_ FILE *f = NULL;
+        _cleanup_fdset_free_ FDSet *fds = NULL;
         assert(m);
@@ -2358,20 +2359,18 @@ int manager_reload(Manager *m) {
         fds = fdset_new();
         if (!fds) {
                 m->n_reloading --;
-                r = -ENOMEM;
-                goto finish;
+                return -ENOMEM;
         }
         r = manager_serialize(m, f, fds, false);
         if (r < 0) {
                 m->n_reloading --;
-                goto finish;
+                return r;
         }
         if (fseeko(f, 0, SEEK_SET) < 0) {
                 m->n_reloading --;
-                r = -errno;
-                goto finish;
+                return -errno;
         }
         /* From here on there is no way back. */
@@ -2415,13 +2414,6 @@ int manager_reload(Manager *m) {
         m->send_reloading_done = true;
-finish:
-        if (f)
-                fclose(f);
-
-        if (fds)
-                fdset_free(fds);
-
         return r;
 }
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index f326f99..1cf67d0 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1305,7 +1305,7 @@ int main(int argc, char *argv[]) {
         bool saved_attr_valid = false;
         struct winsize ws;
         int kmsg_socket_pair[2] = { -1, -1 };
-        FDSet *fds = NULL;
+        _cleanup_fdset_free_ FDSet *fds = NULL;
         log_parse_environment();
         log_open();
@@ -1813,7 +1813,5 @@ finish:
         free(arg_directory);
         free(arg_machine);
-        fdset_free(fds);
-
         return r;
 }
diff --git a/src/shared/fdset.h b/src/shared/fdset.h
index a7bd5e2..1a26005 100644
--- a/src/shared/fdset.h
+++ b/src/shared/fdset.h
@@ -22,6 +22,7 @@
 ***/
 #include "set.h"
+#include "util.h"
 typedef struct FDSet FDSet;
@@ -47,3 +48,9 @@ int fdset_iterate(FDSet *s, Iterator *i);
 #define FDSET_FOREACH(fd, fds, i) \
         for ((i) = ITERATOR_FIRST, (fd) = fdset_iterate((fds), &(i)); (fd) >= 0; (fd) = fdset_iterate((fds), &(i)))
+
+static inline void fdset_freep(FDSet **fds) {
+        if (*fds)
+                fdset_free(*fds);
+}
+#define _cleanup_fdset_free_ _cleanup_(fdset_freep)
SOURCES/0244-Introduce-udev-object-cleanup-functions.patch
New file
@@ -0,0 +1,1291 @@
From 0aad0e32d93d848e707a3cd0edd78c58a4c21829 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 12 Oct 2013 20:28:21 -0400
Subject: [PATCH] Introduce udev object cleanup functions
Conflicts:
    src/backlight/backlight.c
    src/gpt-auto-generator/gpt-auto-generator.c
(cherry picked from commit 1ca208fb4f93e5869704af1812cbff7130a2fc03)
Related: #1098310
---
 Makefile.am                                 |   1 +
 src/backlight/backlight.c                   |  57 +++++------
 src/core/umount.c                           | 143 ++++++++++------------------
 src/cryptsetup/cryptsetup.c                 |  27 ++----
 src/fsck/fsck.c                             |  13 +--
 src/gpt-auto-generator/gpt-auto-generator.c | 121 +++++++----------------
 src/journal/journal-internal.h              |   7 +-
 src/login/sysfs-show.c                      |  22 ++---
 src/readahead/readahead-common.c            |  66 +++++--------
 src/shared/fdset.h                          |   5 +-
 src/shared/install.c                        |   6 +-
 src/shared/set.h                            |  10 +-
 src/shared/strv.h                           |   7 +-
 src/shared/udev-util.h                      |  37 +++++++
 src/shared/util.h                           |  33 +++----
 src/test/test-libudev.c                     |   8 +-
 src/test/test-udev.c                        |  21 ++--
 src/tmpfiles/tmpfiles.c                     |   5 +-
 18 files changed, 227 insertions(+), 362 deletions(-)
 create mode 100644 src/shared/udev-util.h
diff --git a/Makefile.am b/Makefile.am
index fa2fba6..ef73138 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -647,6 +647,7 @@ libsystemd_shared_la_SOURCES = \
     src/shared/sparse-endian.h \
     src/shared/util.c \
     src/shared/util.h \
+    src/shared/udev-util.h \
     src/shared/virt.c \
     src/shared/virt.h \
     src/shared/efivars.c \
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index 9b2eada..aa80c29 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -19,15 +19,15 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
-#include <libudev.h>
-
 #include "util.h"
 #include "mkdir.h"
 #include "fileio.h"
+#include "libudev.h"
+#include "udev-util.h"
 int main(int argc, char *argv[]) {
-        struct udev *udev = NULL;
-        struct udev_device *device = NULL;
+        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
         _cleanup_free_ char *saved = NULL;
         int r;
@@ -45,37 +45,35 @@ int main(int argc, char *argv[]) {
         r = mkdir_p("/var/lib/systemd/backlight", 0755);
         if (r < 0) {
                 log_error("Failed to create backlight directory: %s", strerror(-r));
-                goto finish;
+                return EXIT_FAILURE;
         }
         udev = udev_new();
         if (!udev) {
-                r = log_oom();
-                goto finish;
+                log_oom();
+                return EXIT_FAILURE;
         }
         errno = 0;
         device = udev_device_new_from_subsystem_sysname(udev, "backlight", argv[2]);
         if (!device) {
-                if (errno != 0) {
+                if (errno != 0)
                         log_error("Failed to get backlight device: %m");
-                        r = -errno;
-                } else
-                        r = log_oom();
+                else
+                        log_oom();
-                goto finish;
+                return EXIT_FAILURE;
         }
         if (!streq_ptr(udev_device_get_subsystem(device), "backlight")) {
                 log_error("Not a backlight device: %s", argv[2]);
-                r = -ENODEV;
-                goto finish;
+                return EXIT_FAILURE;
         }
         saved = strappend("/var/lib/systemd/backlight/", udev_device_get_sysname(device));
         if (!saved) {
-                r = log_oom();
-                goto finish;
+                log_oom();
+                return EXIT_FAILURE;
         }
         if (streq(argv[1], "load")) {
@@ -84,19 +82,17 @@ int main(int argc, char *argv[]) {
                 r = read_one_line_file(saved, &value);
                 if (r < 0) {
-                        if (r == -ENOENT) {
-                                r = 0;
-                                goto finish;
-                        }
+                        if (r == -ENOENT)
+                                return EXIT_SUCCESS;
                         log_error("Failed to read %s: %s", saved, strerror(-r));
-                        goto finish;
+                        return EXIT_FAILURE;
                 }
                 r = udev_device_set_sysattr_value(device, "brightness", value);
                 if (r < 0) {
                         log_error("Failed to write system attribute: %s", strerror(-r));
-                        goto finish;
+                        return EXIT_FAILURE;
                 }
         } else if (streq(argv[1], "save")) {
@@ -105,28 +101,19 @@ int main(int argc, char *argv[]) {
                 value = udev_device_get_sysattr_value(device, "brightness");
                 if (!value) {
                         log_error("Failed to read system attribute: %s", strerror(-r));
-                        goto finish;
+                        return EXIT_FAILURE;
                 }
                 r = write_string_file(saved, value);
                 if (r < 0) {
                         log_error("Failed to write %s: %s", saved, strerror(-r));
-                        goto finish;
+                        return EXIT_FAILURE;
                 }
         } else {
                 log_error("Unknown verb %s.", argv[1]);
-                r = -EINVAL;
-                goto finish;
+                return EXIT_FAILURE;
         }
-finish:
-        if (device)
-                udev_device_unref(device);
-
-        if (udev)
-                udev_unref(udev);
-
-        return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
-
+        return EXIT_SUCCESS;
 }
diff --git a/src/core/umount.c b/src/core/umount.c
index 1e95ad7..99dbe27 100644
--- a/src/core/umount.c
+++ b/src/core/umount.c
@@ -27,7 +27,6 @@
 #include <unistd.h>
 #include <linux/loop.h>
 #include <linux/dm-ioctl.h>
-#include <libudev.h>
 #include "list.h"
 #include "mount-setup.h"
@@ -35,6 +34,8 @@
 #include "path-util.h"
 #include "util.h"
 #include "virt.h"
+#include "libudev.h"
+#include "udev-util.h"
 typedef struct MountPoint {
         char *path;
@@ -201,145 +202,108 @@ finish:
 }
 static int loopback_list_get(MountPoint **head) {
-        int r;
-        struct udev *udev;
-        struct udev_enumerate *e = NULL;
+        _cleanup_udev_unref_ struct udev *udev;
+        _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
         struct udev_list_entry *item = NULL, *first = NULL;
         assert(head);
-        if (!(udev = udev_new())) {
-                r = -ENOMEM;
-                goto finish;
-        }
+        udev = udev_new();
+        if (!udev)
+                return -ENOMEM;
-        if (!(e = udev_enumerate_new(udev))) {
-                r = -ENOMEM;
-                goto finish;
-        }
+        e = udev_enumerate_new(udev);
+        if (!e)
+                return -ENOMEM;
         if (udev_enumerate_add_match_subsystem(e, "block") < 0 ||
             udev_enumerate_add_match_sysname(e, "loop*") < 0 ||
-            udev_enumerate_add_match_sysattr(e, "loop/backing_file", NULL) < 0) {
-                r = -EIO;
-                goto finish;
-        }
+            udev_enumerate_add_match_sysattr(e, "loop/backing_file", NULL) < 0)
+                return -EIO;
-        if (udev_enumerate_scan_devices(e) < 0) {
-                r = -EIO;
-                goto finish;
-        }
+        if (udev_enumerate_scan_devices(e) < 0)
+                return -EIO;
         first = udev_enumerate_get_list_entry(e);
         udev_list_entry_foreach(item, first) {
                 MountPoint *lb;
-                struct udev_device *d;
+                _cleanup_udev_device_unref_ struct udev_device *d;
                 char *loop;
                 const char *dn;
-                if (!(d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)))) {
-                        r = -ENOMEM;
-                        goto finish;
-                }
+                d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
+                if (!d)
+                        return -ENOMEM;
-                if (!(dn = udev_device_get_devnode(d))) {
-                        udev_device_unref(d);
+                dn = udev_device_get_devnode(d);
+                if (!dn)
                         continue;
-                }
                 loop = strdup(dn);
-                udev_device_unref(d);
-
-                if (!loop) {
-                        r = -ENOMEM;
-                        goto finish;
-                }
+                if (!loop)
+                        return -ENOMEM;
-                if (!(lb = new0(MountPoint, 1))) {
+                lb = new0(MountPoint, 1);
+                if (!lb) {
                         free(loop);
-                        r = -ENOMEM;
-                        goto finish;
+                        return -ENOMEM;
                 }
                 lb->path = loop;
                 LIST_PREPEND(MountPoint, mount_point, *head, lb);
         }
-        r = 0;
-
-finish:
-        if (e)
-                udev_enumerate_unref(e);
-
-        if (udev)
-                udev_unref(udev);
-
-        return r;
+        return 0;
 }
 static int dm_list_get(MountPoint **head) {
-        int r;
-        struct udev *udev;
-        struct udev_enumerate *e = NULL;
+        _cleanup_udev_unref_ struct udev *udev;
+        _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
         struct udev_list_entry *item = NULL, *first = NULL;
         assert(head);
-        if (!(udev = udev_new())) {
-                r = -ENOMEM;
-                goto finish;
-        }
+        udev = udev_new();
+        if (!udev)
+                return -ENOMEM;
-        if (!(e = udev_enumerate_new(udev))) {
-                r = -ENOMEM;
-                goto finish;
-        }
+        e = udev_enumerate_new(udev);
+        if (!e)
+                return -ENOMEM;
         if (udev_enumerate_add_match_subsystem(e, "block") < 0 ||
-            udev_enumerate_add_match_sysname(e, "dm-*") < 0) {
-                r = -EIO;
-                goto finish;
-        }
+            udev_enumerate_add_match_sysname(e, "dm-*") < 0)
+                return -EIO;
-        if (udev_enumerate_scan_devices(e) < 0) {
-                r = -EIO;
-                goto finish;
-        }
+        if (udev_enumerate_scan_devices(e) < 0)
+                return -EIO;
         first = udev_enumerate_get_list_entry(e);
         udev_list_entry_foreach(item, first) {
                 MountPoint *m;
-                struct udev_device *d;
+                _cleanup_udev_device_unref_ struct udev_device *d;
                 dev_t devnum;
                 char *node;
                 const char *dn;
-                if (!(d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)))) {
-                        r = -ENOMEM;
-                        goto finish;
-                }
+                d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
+                if (!d)
+                        return -ENOMEM;
                 devnum = udev_device_get_devnum(d);
                 dn = udev_device_get_devnode(d);
-
-                if (major(devnum) == 0 || !dn) {
-                        udev_device_unref(d);
+                if (major(devnum) == 0 || !dn)
                         continue;
-                }
                 node = strdup(dn);
-                udev_device_unref(d);
-
-                if (!node) {
-                        r = -ENOMEM;
-                        goto finish;
-                }
+                if (!node)
+                        return -ENOMEM;
-                if (!(m = new(MountPoint, 1))) {
+                m = new(MountPoint, 1);
+                if (!m) {
                         free(node);
-                        r = -ENOMEM;
-                        goto finish;
+                        return -ENOMEM;
                 }
                 m->path = node;
@@ -347,16 +311,7 @@ static int dm_list_get(MountPoint **head) {
                 LIST_PREPEND(MountPoint, mount_point, *head, m);
         }
-        r = 0;
-
-finish:
-        if (e)
-                udev_enumerate_unref(e);
-
-        if (udev)
-                udev_unref(udev);
-
-        return r;
+        return 0;
 }
 static int delete_loopback(const char *device) {
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 4f2f52a..0a15b50 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -25,7 +25,6 @@
 #include <mntent.h>
 #include <libcryptsetup.h>
-#include <libudev.h>
 #include "fileio.h"
 #include "log.h"
@@ -34,6 +33,8 @@
 #include "strv.h"
 #include "ask-password-api.h"
 #include "def.h"
+#include "libudev.h"
+#include "udev-util.h"
 static const char *opt_type = NULL; /* CRYPT_LUKS1, CRYPT_TCRYPT or CRYPT_PLAIN */
 static char *opt_cipher = NULL;
@@ -184,7 +185,7 @@ static void log_glue(int level, const char *msg, void *usrptr) {
         log_debug("%s", msg);
 }
-static char *disk_description(const char *path) {
+static char* disk_description(const char *path) {
         static const char name_fields[] = {
                 "ID_PART_ENTRY_NAME\0"
@@ -193,10 +194,9 @@ static char *disk_description(const char *path) {
                 "ID_MODEL\0"
         };
-        struct udev *udev = NULL;
-        struct udev_device *device = NULL;
+        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
         struct stat st;
-        char *description = NULL;
         const char *i;
         assert(path);
@@ -213,26 +213,17 @@ static char *disk_description(const char *path) {
         device = udev_device_new_from_devnum(udev, 'b', st.st_rdev);
         if (!device)
-                goto finish;
+                return NULL;
         NULSTR_FOREACH(i, name_fields) {
                 const char *name;
                 name = udev_device_get_property_value(device, i);
-                if (!isempty(name)) {
-                        description = strdup(name);
-                        break;
-                }
+                if (!isempty(name))
+                        return strdup(name);
         }
-finish:
-        if (device)
-                udev_device_unref(device);
-
-        if (udev)
-                udev_unref(udev);
-
-        return description;
+        return NULL;
 }
 static char *disk_mount_point(const char *label) {
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index f298cf7..96a79dd 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -27,7 +27,6 @@
 #include <fcntl.h>
 #include <sys/file.h>
-#include <libudev.h>
 #include <dbus/dbus.h>
 #include "util.h"
@@ -36,6 +35,8 @@
 #include "bus-errors.h"
 #include "virt.h"
 #include "fileio.h"
+#include "libudev.h"
+#include "udev-util.h"
 static bool arg_skip = false;
 static bool arg_force = false;
@@ -251,8 +252,8 @@ int main(int argc, char *argv[]) {
         int i = 0, r = EXIT_FAILURE, q;
         pid_t pid;
         siginfo_t status;
-        struct udev *udev = NULL;
-        struct udev_device *udev_device = NULL;
+        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_udev_device_unref_ struct udev_device *udev_device = NULL;
         const char *device;
         bool root_directory;
         int progress_pipe[2] = { -1, -1 };
@@ -400,12 +401,6 @@ int main(int argc, char *argv[]) {
                 touch("/run/systemd/quotacheck");
 finish:
-        if (udev_device)
-                udev_device_unref(udev_device);
-
-        if (udev)
-                udev_unref(udev);
-
         close_pipe(progress_pipe);
         return r;
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index adbf71d..8436d26 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -36,6 +36,7 @@
 #include "missing.h"
 #include "sd-id128.h"
 #include "libudev.h"
+#include "udev-util.h"
 #include "special.h"
 #include "unit-name.h"
 #include "virt.h"
@@ -50,10 +51,7 @@
 static const char *arg_dest = "/tmp";
-static inline void blkid_free_probep(blkid_probe *b) {
-        if (*b)
-                blkid_free_probe(*b);
-}
+define_trivial_cleanup_func(blkid_probe, blkid_free_probe)
 #define _cleanup_blkid_freep_probe_ _cleanup_(blkid_free_probep)
 static int verify_gpt_partition(const char *node, sd_id128_t *type, unsigned *nr, char **fstype) {
@@ -236,75 +234,62 @@ static int add_home(const char *path, const char *fstype) {
 }
 static int enumerate_partitions(struct udev *udev, dev_t dev) {
-        struct udev_enumerate *e = NULL;
-        struct udev_device *parent = NULL, *d = NULL;
+        struct udev_device *parent = NULL;
+        _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
+        _cleanup_udev_device_unref_ struct udev_device *d = NULL;
         struct udev_list_entry *first, *item;
         unsigned home_nr = (unsigned) -1;
         _cleanup_free_ char *home = NULL, *home_fstype = NULL;
         int r;
         e = udev_enumerate_new(udev);
-        if (!e) {
-                r = log_oom();
-                goto finish;
-        }
+        if (!e)
+                return log_oom();
         d = udev_device_new_from_devnum(udev, 'b', dev);
-        if (!d) {
-                r = log_oom();
-                goto finish;
-        }
+        if (!d)
+                return log_oom();
         parent = udev_device_get_parent(d);
-        if (!parent) {
-                r = log_oom();
-                goto finish;
-        }
+        if (!parent)
+                return log_oom();
         r = udev_enumerate_add_match_parent(e, parent);
-        if (r < 0) {
-                r = log_oom();
-                goto finish;
-        }
+        if (r < 0)
+                return log_oom();
         r = udev_enumerate_add_match_subsystem(e, "block");
-        if (r < 0) {
-                r = log_oom();
-                goto finish;
-        }
+        if (r < 0)
+                return log_oom();
         r = udev_enumerate_scan_devices(e);
         if (r < 0) {
                 log_error("Failed to enumerate partitions on /dev/block/%u:%u: %s",
                           major(dev), minor(dev), strerror(-r));
-                goto finish;
+                return r;
         }
         first = udev_enumerate_get_list_entry(e);
         udev_list_entry_foreach(item, first) {
                 _cleanup_free_ char *fstype = NULL;
                 const char *node = NULL;
-                struct udev_device *q;
+                _cleanup_udev_device_unref_ struct udev_device *q;
                 sd_id128_t type_id;
                 unsigned nr;
                 q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
-                if (!q) {
-                        r = log_oom();
-                        goto finish;
-                }
+                if (!q)
+                        return log_oom();
                 if (udev_device_get_devnum(q) == udev_device_get_devnum(d))
-                        goto skip;
+                        continue;
                 if (udev_device_get_devnum(q) == udev_device_get_devnum(parent))
-                        goto skip;
+                        continue;
                 node = udev_device_get_devnode(q);
-                if (!node) {
-                        r = log_oom();
-                        goto finish;
-                }
+                if (!node)
+                        return log_oom();
                 r = verify_gpt_partition(node, &type_id, &nr, &fstype);
                 if (r < 0) {
@@ -313,11 +298,10 @@ static int enumerate_partitions(struct udev *udev, dev_t dev) {
                                 continue;
                         log_error("Failed to verify GPT partition %s: %s",
                                   node, strerror(-r));
-                        udev_device_unref(q);
-                        goto finish;
+                        return r;
                 }
                 if (r == 0)
-                        goto skip;
+                        continue;
                 if (sd_id128_equal(type_id, SD_ID128_MAKE(06,57,fd,6d,a4,ab,43,c4,84,e5,09,33,c8,4b,4f,4f)))
                         add_swap(node, fstype);
@@ -326,10 +310,8 @@ static int enumerate_partitions(struct udev *udev, dev_t dev) {
                         if (!home || nr < home_nr) {
                                 free(home);
                                 home = strdup(node);
-                                if (!home) {
-                                        r = log_oom();
-                                        goto finish;
-                                }
+                                if (!home)
+                                        return log_oom();
                                 home_nr = nr;
@@ -338,22 +320,11 @@ static int enumerate_partitions(struct udev *udev, dev_t dev) {
                                 fstype = NULL;
                         }
                 }
-
-        skip:
-                udev_device_unref(q);
         }
         if (home && home_fstype)
                 add_home(home, home_fstype);
-finish:
-        if (d)
-                udev_device_unref(d);
-
-        if (e)
-                udev_enumerate_unref(e);
-
-
         return r;
 }
@@ -432,44 +403,31 @@ static int get_block_device(const char *path, dev_t *dev) {
 }
 static int devno_to_devnode(struct udev *udev, dev_t devno, char **ret) {
-        struct udev_device *d = NULL;
+        _cleanup_udev_device_unref_ struct udev_device *d;
         const char *t;
         char *n;
-        int r;
         d = udev_device_new_from_devnum(udev, 'b', devno);
-        if (!d) {
-                r = log_oom();
-                goto finish;
-        }
+        if (!d)
+                return log_oom();
         t = udev_device_get_devnode(d);
-        if (!t) {
-                r = -ENODEV;
-                goto finish;
-        }
+        if (!t)
+                return -ENODEV;
         n = strdup(t);
-        if (!n) {
-                r = -ENOMEM;
-                goto finish;
-        }
+        if (!n)
+                return -ENOMEM;
         *ret = n;
-        r = 0;
-
-finish:
-        if (d)
-                udev_device_unref(d);
-
-        return r;
+        return 0;
 }
 int main(int argc, char *argv[]) {
         _cleanup_free_ char *node = NULL;
-        struct udev *udev = NULL;
+        _cleanup_udev_unref_ struct udev *udev = NULL;
         dev_t devno;
-        int r;
+        int r = 0;
         if (argc > 1 && argc != 4) {
                 log_error("This program takes three or no arguments.");
@@ -488,13 +446,11 @@ int main(int argc, char *argv[]) {
         if (in_initrd()) {
                 log_debug("In initrd, exiting.");
-                r = 0;
                 goto finish;
         }
         if (detect_container(NULL) > 0) {
                 log_debug("In a container, exiting.");
-                r = 0;
                 goto finish;
         }
@@ -533,8 +489,5 @@ int main(int argc, char *argv[]) {
         r = enumerate_partitions(udev, devno);
 finish:
-        if (udev)
-                udev_unref(udev);
-
         return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }
diff --git a/src/journal/journal-internal.h b/src/journal/journal-internal.h
index 5bc6535..1bc912c 100644
--- a/src/journal/journal-internal.h
+++ b/src/journal/journal-internal.h
@@ -135,11 +135,8 @@ struct sd_journal {
 char *journal_make_match_string(sd_journal *j);
 void journal_print_header(sd_journal *j);
-static inline void journal_closep(sd_journal **j) {
-        sd_journal_close(*j);
-}
-
-#define _cleanup_journal_close_ _cleanup_(journal_closep)
+define_trivial_cleanup_func(sd_journal*, sd_journal_close)
+#define _cleanup_journal_close_ _cleanup_(sd_journal_closep)
 #define JOURNAL_FOREACH_DATA_RETVAL(j, data, l, retval)                     \
         for (sd_journal_restart_data(j); ((retval) = sd_journal_enumerate_data((j), &(data), &(l))) > 0; )
diff --git a/src/login/sysfs-show.c b/src/login/sysfs-show.c
index 14de7d8..9fc3054 100644
--- a/src/login/sysfs-show.c
+++ b/src/login/sysfs-show.c
@@ -26,6 +26,7 @@
 #include "util.h"
 #include "sysfs-show.h"
 #include "path-util.h"
+#include "udev-util.h"
 static int show_sysfs_one(
                 struct udev *udev,
@@ -143,9 +144,9 @@ static int show_sysfs_one(
 }
 int show_sysfs(const char *seat, const char *prefix, unsigned n_columns) {
-        struct udev *udev;
+        _cleanup_udev_unref_ struct udev *udev;
+        _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
         struct udev_list_entry *first = NULL;
-        struct udev_enumerate *e;
         int r;
         if (n_columns <= 0)
@@ -162,10 +163,8 @@ int show_sysfs(const char *seat, const char *prefix, unsigned n_columns) {
                 return -ENOMEM;
         e = udev_enumerate_new(udev);
-        if (!e) {
-                r = -ENOMEM;
-                goto finish;
-        }
+        if (!e)
+                return ENOMEM;
         if (!streq(seat, "seat0"))
                 r = udev_enumerate_add_match_tag(e, seat);
@@ -173,11 +172,11 @@ int show_sysfs(const char *seat, const char *prefix, unsigned n_columns) {
                 r = udev_enumerate_add_match_tag(e, "seat");
         if (r < 0)
-                goto finish;
+                return r;
         r = udev_enumerate_scan_devices(e);
         if (r < 0)
-                goto finish;
+                return r;
         first = udev_enumerate_get_list_entry(e);
         if (first)
@@ -185,12 +184,5 @@ int show_sysfs(const char *seat, const char *prefix, unsigned n_columns) {
         else
                 printf("%s%s%s\n", prefix, draw_special_char(DRAW_TREE_RIGHT), "(none)");
-finish:
-        if (e)
-                udev_enumerate_unref(e);
-
-        if (udev)
-                udev_unref(udev);
-
         return r;
 }
diff --git a/src/readahead/readahead-common.c b/src/readahead/readahead-common.c
index a234a89..aea1fbe 100644
--- a/src/readahead/readahead-common.c
+++ b/src/readahead/readahead-common.c
@@ -27,13 +27,14 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 #include <unistd.h>
-#include <libudev.h>
 #include "log.h"
 #include "readahead-common.h"
 #include "util.h"
 #include "missing.h"
 #include "fileio.h"
+#include "libudev.h"
+#include "udev-util.h"
 int file_verify(int fd, const char *fn, off_t file_size_max, struct stat *st) {
         assert(fd >= 0);
@@ -60,9 +61,9 @@ int file_verify(int fd, const char *fn, off_t file_size_max, struct stat *st) {
 int fs_on_ssd(const char *p) {
         struct stat st;
-        struct udev *udev = NULL;
-        struct udev_device *udev_device = NULL, *look_at = NULL;
-        bool b = false;
+        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_udev_device_unref_ struct udev_device *udev_device = NULL;
+        struct udev_device *look_at = NULL;
         const char *devtype, *rotational, *model, *id;
         int r;
@@ -128,7 +129,7 @@ int fs_on_ssd(const char *p) {
         udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev);
         if (!udev_device)
-                goto finish;
+                return false;
         devtype = udev_device_get_property_value(udev_device, "DEVTYPE");
         if (devtype && streq(devtype, "partition"))
@@ -137,46 +138,34 @@ int fs_on_ssd(const char *p) {
                 look_at = udev_device;
         if (!look_at)
-                goto finish;
+                return false;
         /* First, try high-level property */
         id = udev_device_get_property_value(look_at, "ID_SSD");
-        if (id) {
-                b = streq(id, "1");
-                goto finish;
-        }
+        if (id)
+                return streq(id, "1");
         /* Second, try kernel attribute */
         rotational = udev_device_get_sysattr_value(look_at, "queue/rotational");
-        if (rotational) {
-                b = streq(rotational, "0");
-                goto finish;
-        }
+        if (rotational)
+                return streq(rotational, "0");
         /* Finally, fallback to heuristics */
         look_at = udev_device_get_parent(look_at);
         if (!look_at)
-                goto finish;
+                return false;
         model = udev_device_get_sysattr_value(look_at, "model");
         if (model)
-                b = !!strstr(model, "SSD");
-
-finish:
-        if (udev_device)
-                udev_device_unref(udev_device);
-
-        if (udev)
-                udev_unref(udev);
+                return !!strstr(model, "SSD");
-        return b;
+        return false;
 }
 int fs_on_read_only(const char *p) {
         struct stat st;
-        struct udev *udev = NULL;
-        struct udev_device *udev_device = NULL;
-        bool b = false;
+        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_udev_device_unref_ struct udev_device *udev_device = NULL;
         const char *read_only;
         assert(p);
@@ -187,24 +176,19 @@ int fs_on_read_only(const char *p) {
         if (major(st.st_dev) == 0)
                 return false;
-        if (!(udev = udev_new()))
+        udev = udev_new();
+        if (!udev)
                 return -ENOMEM;
-        if (!(udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev)))
-                goto finish;
-
-        if ((read_only = udev_device_get_sysattr_value(udev_device, "ro")))
-                if ((b = streq(read_only, "1")))
-                        goto finish;
-
-finish:
-        if (udev_device)
-                udev_device_unref(udev_device);
+        udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev);
+        if (!udev_device)
+                return false;
-        if (udev)
-                udev_unref(udev);
+        read_only = udev_device_get_sysattr_value(udev_device, "ro");
+        if (read_only)
+                return streq(read_only, "1");
-        return b;
+        return false;
 }
 bool enough_ram(void) {
diff --git a/src/shared/fdset.h b/src/shared/fdset.h
index 1a26005..6277e46 100644
--- a/src/shared/fdset.h
+++ b/src/shared/fdset.h
@@ -49,8 +49,5 @@ int fdset_iterate(FDSet *s, Iterator *i);
 #define FDSET_FOREACH(fd, fds, i) \
         for ((i) = ITERATOR_FIRST, (fd) = fdset_iterate((fds), &(i)); (fd) >= 0; (fd) = fdset_iterate((fds), &(i)))
-static inline void fdset_freep(FDSet **fds) {
-        if (*fds)
-                fdset_free(*fds);
-}
+define_trivial_cleanup_func(FDSet*, fdset_free)
 #define _cleanup_fdset_free_ _cleanup_(fdset_freep)
diff --git a/src/shared/install.c b/src/shared/install.c
index 9722ed4..b9c85b7 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -44,10 +44,8 @@ typedef struct {
         Hashmap *have_installed;
 } InstallContext;
-#define _cleanup_lookup_paths_free_ \
-        __attribute__((cleanup(lookup_paths_free)))
-#define _cleanup_install_context_done_ \
-        __attribute__((cleanup(install_context_done)))
+#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
+#define _cleanup_install_context_done_ _cleanup_(install_context_done)
 static int lookup_paths_init_from_scope(LookupPaths *paths, UnitFileScope scope) {
         assert(paths);
diff --git a/src/shared/set.h b/src/shared/set.h
index e5d46e9..a291470 100644
--- a/src/shared/set.h
+++ b/src/shared/set.h
@@ -28,19 +28,13 @@
  * for each set use. */
 #include "hashmap.h"
+#include "util.h"
 typedef struct Set Set;
 Set *set_new(hash_func_t hash_func, compare_func_t compare_func);
 void set_free(Set* s);
-static inline void set_freep(Set **s) {
-        set_free(*s);
-}
-
 void set_free_free(Set *s);
-static inline void set_free_freep(Set **s) {
-        set_free_free(*s);
-}
 Set* set_copy(Set *s);
 int set_ensure_allocated(Set **s, hash_func_t hash_func, compare_func_t compare_func);
@@ -79,5 +73,7 @@ char **set_get_strv(Set *s);
 #define SET_FOREACH_BACKWARDS(e, s, i) \
         for ((i) = ITERATOR_LAST, (e) = set_iterate_backwards((s), &(i)); (e); (e) = set_iterate_backwards((s), &(i)))
+define_trivial_cleanup_func(Set*, set_free)
+define_trivial_cleanup_func(Set*, set_free_free)
 #define _cleanup_set_free_ _cleanup_(set_freep)
 #define _cleanup_set_free_free_ _cleanup_(set_free_freep)
diff --git a/src/shared/strv.h b/src/shared/strv.h
index d1f2a0e..4d117f8 100644
--- a/src/shared/strv.h
+++ b/src/shared/strv.h
@@ -24,16 +24,13 @@
 #include <stdarg.h>
 #include <stdbool.h>
-#include "macro.h"
+#include "util.h"
 char *strv_find(char **l, const char *name) _pure_;
 char *strv_find_prefix(char **l, const char *name) _pure_;
 void strv_free(char **l);
-static inline void strv_freep(char ***l) {
-        strv_free(*l);
-}
-
+define_trivial_cleanup_func(char**, strv_free)
 #define _cleanup_strv_free_ _cleanup_(strv_freep)
 char **strv_copy(char * const *l);
diff --git a/src/shared/udev-util.h b/src/shared/udev-util.h
new file mode 100644
index 0000000..bff8f5f
--- /dev/null
+++ b/src/shared/udev-util.h
@@ -0,0 +1,37 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+  This file is part of systemd.
+
+  Copyright 2013 Zbigniew Jędrzejewski-Szmek
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "udev.h"
+#include "util.h"
+
+define_trivial_cleanup_func(struct udev*, udev_unref)
+define_trivial_cleanup_func(struct udev_device*, udev_device_unref)
+define_trivial_cleanup_func(struct udev_enumerate*, udev_enumerate_unref)
+define_trivial_cleanup_func(struct udev_event*, udev_event_unref)
+define_trivial_cleanup_func(struct udev_rules*, udev_rules_unref)
+
+#define _cleanup_udev_unref_ _cleanup_(udev_unrefp)
+#define _cleanup_udev_device_unref_ _cleanup_(udev_device_unrefp)
+#define _cleanup_udev_enumerate_unref_ _cleanup_(udev_enumerate_unrefp)
+#define _cleanup_udev_event_unref_ _cleanup_(udev_event_unrefp)
+#define _cleanup_udev_rules_unref_ _cleanup_(udev_rules_unrefp)
diff --git a/src/shared/util.h b/src/shared/util.h
index 5a1e1bc..e577ef0 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -556,42 +556,33 @@ static inline void freep(void *p) {
         free(*(void**) p);
 }
-static inline void fclosep(FILE **f) {
-        if (*f)
-                fclose(*f);
-}
-
-static inline void pclosep(FILE **f) {
-        if (*f)
-                pclose(*f);
-}
+#define define_trivial_cleanup_func(type, func) \
+        static inline void func##p(type *p) {   \
+        if (*p)                                 \
+                func(*p);                       \
+        }                                       \
 static inline void closep(int *fd) {
         if (*fd >= 0)
                 close_nointr_nofail(*fd);
 }
-static inline void closedirp(DIR **d) {
-        if (*d)
-                closedir(*d);
-}
-
 static inline void umaskp(mode_t *u) {
         umask(*u);
 }
-static inline void endmntentp(FILE **f) {
-        if (*f)
-                endmntent(*f);
-}
+define_trivial_cleanup_func(FILE*, fclose)
+define_trivial_cleanup_func(FILE*, pclose)
+define_trivial_cleanup_func(DIR*, closedir)
+define_trivial_cleanup_func(FILE*, endmntent)
 #define _cleanup_free_ _cleanup_(freep)
-#define _cleanup_fclose_ _cleanup_(fclosep)
-#define _cleanup_pclose_ _cleanup_(pclosep)
 #define _cleanup_close_ _cleanup_(closep)
-#define _cleanup_closedir_ _cleanup_(closedirp)
 #define _cleanup_umask_ _cleanup_(umaskp)
 #define _cleanup_globfree_ _cleanup_(globfree)
+#define _cleanup_fclose_ _cleanup_(fclosep)
+#define _cleanup_pclose_ _cleanup_(pclosep)
+#define _cleanup_closedir_ _cleanup_(closedirp)
 #define _cleanup_endmntent_ _cleanup_(endmntentp)
 _malloc_  _alloc_(1, 2) static inline void *malloc_multiply(size_t a, size_t b) {
diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c
index 716767b..ab7d5a9 100644
--- a/src/test/test-libudev.c
+++ b/src/test/test-libudev.c
@@ -29,6 +29,7 @@
 #include <sys/epoll.h>
 #include "libudev.h"
+#include "udev-util.h"
 #include "util.h"
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
@@ -117,7 +118,7 @@ static void print_device(struct udev_device *device)
 static int test_device(struct udev *udev, const char *syspath)
 {
-        struct udev_device *device;
+        _cleanup_udev_device_unref_ struct udev_device *device;
         printf("looking at device: %s\n", syspath);
         device = udev_device_new_from_syspath(udev, syspath);
@@ -126,13 +127,13 @@ static int test_device(struct udev *udev, const char *syspath)
                 return -1;
         }
         print_device(device);
-        udev_device_unref(device);
+
         return 0;
 }
 static int test_device_parents(struct udev *udev, const char *syspath)
 {
-        struct udev_device *device;
+        _cleanup_udev_device_unref_ struct udev_device *device;
         struct udev_device *device_parent;
         printf("looking at device: %s\n", syspath);
@@ -153,7 +154,6 @@ static int test_device_parents(struct udev *udev, const char *syspath)
                 print_device(device_parent);
                 device_parent = udev_device_get_parent(device_parent);
         } while (device_parent != NULL);
-        udev_device_unref(device);
         return 0;
 }
diff --git a/src/test/test-udev.c b/src/test/test-udev.c
index 52b61b4..17825f1 100644
--- a/src/test/test-udev.c
+++ b/src/test/test-udev.c
@@ -34,6 +34,7 @@
 #include "missing.h"
 #include "udev.h"
+#include "udev-util.h"
 void udev_main_log(struct udev *udev, int priority,
                    const char *file, int line, const char *fn,
@@ -82,10 +83,10 @@ out:
 int main(int argc, char *argv[])
 {
-        struct udev *udev;
-        struct udev_event *event = NULL;
-        struct udev_device *dev = NULL;
-        struct udev_rules *rules = NULL;
+        _cleanup_udev_unref_ struct udev *udev = NULL;
+        _cleanup_udev_event_unref_ struct udev_event *event = NULL;
+        _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+        _cleanup_udev_rules_unref_ struct udev_rules *rules = NULL;
         char syspath[UTIL_PATH_SIZE];
         const char *devpath;
         const char *action;
@@ -98,7 +99,8 @@ int main(int argc, char *argv[])
         udev = udev_new();
         if (udev == NULL)
-                exit(EXIT_FAILURE);
+                return EXIT_FAILURE;
+
         log_debug("version %s\n", VERSION);
         label_init("/dev");
@@ -160,12 +162,7 @@ int main(int argc, char *argv[])
 out:
         if (event != NULL && event->fd_signal >= 0)
                 close(event->fd_signal);
-        udev_event_unref(event);
-        udev_device_unref(dev);
-        udev_rules_unref(rules);
         label_finish();
-        udev_unref(udev);
-        if (err != 0)
-                return EXIT_FAILURE;
-        return EXIT_SUCCESS;
+
+        return err ? EXIT_FAILURE : EXIT_SUCCESS;
 }
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 67b13bc..309fa07 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -996,10 +996,7 @@ static void item_free(Item *i) {
         free(i);
 }
-static inline void item_freep(Item **i) {
-        if (*i)
-                item_free(*i);
-}
+define_trivial_cleanup_func(Item*, item_free)
 #define _cleanup_item_free_ _cleanup_(item_freep)
 static bool item_equal(Item *a, Item *b) {
SOURCES/0245-fsck-modernization.patch
New file
@@ -0,0 +1,140 @@
From 64de3526cce9ef980b37fcb5c412a2734132ad47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 11 Nov 2013 23:32:31 -0500
Subject: [PATCH] fsck: modernization
(cherry picked from commit e375825da0cbdbf3be755c277f9c0dec35b41a09)
Related: #1098310
---
 src/fsck/fsck.c | 43 ++++++++++++++++++-------------------------
 1 file changed, 18 insertions(+), 25 deletions(-)
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 96a79dd..9b4e555 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -176,7 +176,7 @@ static double percent(int pass, unsigned long cur, unsigned long max) {
 }
 static int process_progress(int fd) {
-        FILE *f, *console;
+        _cleanup_fclose_ FILE *console = NULL, *f = NULL;
         usec_t last = 0;
         bool locked = false;
         int clear = 0;
@@ -188,15 +188,13 @@ static int process_progress(int fd) {
         }
         console = fopen("/dev/console", "w");
-        if (!console) {
-                fclose(f);
+        if (!console)
                 return -ENOMEM;
-        }
         while (!feof(f)) {
                 int pass, m;
                 unsigned long cur, max;
-                char *device;
+                _cleanup_free_ char *device = NULL;
                 double p;
                 usec_t t;
@@ -205,20 +203,16 @@ static int process_progress(int fd) {
                 /* Only show one progress counter at max */
                 if (!locked) {
-                        if (flock(fileno(console), LOCK_EX|LOCK_NB) < 0) {
-                                free(device);
+                        if (flock(fileno(console), LOCK_EX|LOCK_NB) < 0)
                                 continue;
-                        }
                         locked = true;
                 }
                 /* Only update once every 50ms */
                 t = now(CLOCK_MONOTONIC);
-                if (last + 50 * USEC_PER_MSEC > t)  {
-                        free(device);
+                if (last + 50 * USEC_PER_MSEC > t)
                         continue;
-                }
                 last = t;
@@ -226,8 +220,6 @@ static int process_progress(int fd) {
                 fprintf(console, "\r%s: fsck %3.1f%% complete...\r%n", device, p, &m);
                 fflush(console);
-                free(device);
-
                 if (m > clear)
                         clear = m;
         }
@@ -242,8 +234,6 @@ static int process_progress(int fd) {
                 fflush(console);
         }
-        fclose(f);
-        fclose(console);
         return 0;
 }
@@ -287,34 +277,37 @@ int main(int argc, char *argv[]) {
                 if (stat("/", &st) < 0) {
                         log_error("Failed to stat() the root directory: %m");
-                        goto finish;
+                        return EXIT_FAILURE;
                 }
                 /* Virtual root devices don't need an fsck */
                 if (major(st.st_dev) == 0)
-                        return 0;
+                        return EXIT_SUCCESS;
                 /* check if we are already writable */
                 times[0] = st.st_atim;
                 times[1] = st.st_mtim;
                 if (utimensat(AT_FDCWD, "/", times, 0) == 0) {
                         log_info("Root directory is writable, skipping check.");
-                        return 0;
+                        return EXIT_SUCCESS;
                 }
-                if (!(udev = udev_new())) {
+                udev = udev_new();
+                if (!udev) {
                         log_oom();
-                        goto finish;
+                        return EXIT_FAILURE;
                 }
-                if (!(udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev))) {
+                udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev);
+                if (!udev_device) {
                         log_error("Failed to detect root device.");
-                        goto finish;
+                        return EXIT_FAILURE;
                 }
-                if (!(device = udev_device_get_devnode(udev_device))) {
+                device = udev_device_get_devnode(udev_device);
+                if (!device) {
                         log_error("Failed to detect device node of root directory.");
-                        goto finish;
+                        return EXIT_FAILURE;
                 }
                 root_directory = true;
@@ -323,7 +316,7 @@ int main(int argc, char *argv[]) {
         if (arg_show_progress)
                 if (pipe(progress_pipe) < 0) {
                         log_error("pipe(): %m");
-                        goto finish;
+                        return EXIT_FAILURE;
                 }
         cmdline[i++] = "/sbin/fsck";
SOURCES/0246-fsck-fstab-generator-be-lenient-about-missing-fsck.-.patch
New file
@@ -0,0 +1,212 @@
From c9e49e522d609f39ab77cbab18b8f1389692e1b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 12 Nov 2013 00:53:59 -0500
Subject: [PATCH] fsck,fstab-generator: be lenient about missing fsck.<type>
If fstab contains 1 for passno, treat this as an error, but only warn
briefly. If fstab doesn't contain this information, don't complain at
all.
Patch is complicated a bit by the fact that we might have the fstype specified
in fstab or on /proc/cmdline, in which case we can check if we have the appropriate
fsck tool, or not specified, or specified as auto, in which case we have to look
and check the type of the filesystem ourselves. It cannot be done before the
device appears, so it is too early in the generator phase, and it must be done
directly in fsck service.
(cherry picked from commit 94192cdaf652c9717f15274504ed315126c07a93)
Resolves: #1098310
---
 src/fsck/fsck.c                       | 40 ++++++++++++++----
 src/fstab-generator/fstab-generator.c | 77 +++++++++++++++++++++++------------
 2 files changed, 82 insertions(+), 35 deletions(-)
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 9b4e555..1189fe7 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -244,10 +244,11 @@ int main(int argc, char *argv[]) {
         siginfo_t status;
         _cleanup_udev_unref_ struct udev *udev = NULL;
         _cleanup_udev_device_unref_ struct udev_device *udev_device = NULL;
-        const char *device;
+        const char *device, *type;
         bool root_directory;
         int progress_pipe[2] = { -1, -1 };
         char dash_c[2+10+1];
+        struct stat st;
         if (argc > 2) {
                 log_error("This program expects one or no arguments.");
@@ -266,11 +267,27 @@ int main(int argc, char *argv[]) {
         if (!arg_force && arg_skip)
                 return 0;
+        udev = udev_new();
+        if (!udev) {
+                log_oom();
+                return EXIT_FAILURE;
+        }
+
         if (argc > 1) {
                 device = argv[1];
                 root_directory = false;
+
+                if (stat(device, &st) < 0) {
+                        log_error("Failed to stat '%s': %m", device);
+                        return EXIT_FAILURE;
+                }
+
+                udev_device = udev_device_new_from_devnum(udev, 'b', st.st_rdev);
+                if (!udev_device) {
+                        log_error("Failed to detect device %s", device);
+                        return EXIT_FAILURE;
+                }
         } else {
-                struct stat st;
                 struct timespec times[2];
                 /* Find root device */
@@ -292,12 +309,6 @@ int main(int argc, char *argv[]) {
                         return EXIT_SUCCESS;
                 }
-                udev = udev_new();
-                if (!udev) {
-                        log_oom();
-                        return EXIT_FAILURE;
-                }
-
                 udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev);
                 if (!udev_device) {
                         log_error("Failed to detect root device.");
@@ -313,6 +324,19 @@ int main(int argc, char *argv[]) {
                 root_directory = true;
         }
+        type = udev_device_get_property_value(udev_device, "ID_FS_TYPE");
+        if (type) {
+                const char *checker = strappenda("/sbin/fsck.", type);
+                r = access(checker, X_OK);
+                if (r < 0) {
+                        if (errno == ENOENT) {
+                                log_info("%s doesn't exist, not checking file system.", checker);
+                                return EXIT_SUCCESS;
+                        } else
+                                log_warning("%s cannot be used: %m", checker);
+                }
+        }
+
         if (arg_show_progress)
                 if (pipe(progress_pipe) < 0) {
                         log_error("pipe(): %m");
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 78d7609..fa23ac9 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -147,6 +147,52 @@ static bool mount_in_initrd(struct mntent *me) {
                 streq(me->mnt_dir, "/usr");
 }
+static int add_fsck(FILE *f, const char *what, const char *where, const char *type, int passno) {
+        assert(f);
+
+        if (passno == 0)
+                return 0;
+
+        if (type && !streq(type, "auto")) {
+                int r;
+                const char *checker;
+
+                checker = strappenda("/sbin/fsck.", type);
+                r = access(checker, X_OK);
+                if (r < 0) {
+                        log_warning("Checking was requested for %s, but %s cannot be used: %m", what, checker);
+
+                        /* treat missing check as essentially OK */
+                        return errno == ENOENT ? 0 : -errno;
+                }
+        }
+
+        if (streq(where, "/")) {
+                char *lnk;
+
+                lnk = strappenda(arg_dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/systemd-fsck-root.service");
+                mkdir_parents_label(lnk, 0755);
+                if (symlink("systemd-fsck-root.service", lnk) < 0) {
+                        log_error("Failed to create symlink %s: %m", lnk);
+                        return -errno;
+                }
+        } else {
+                _cleanup_free_ char *fsck = NULL;
+
+                fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
+                if (!fsck)
+                        return log_oom();
+
+                fprintf(f,
+                        "Requires=%s\n"
+                        "After=%s\n",
+                        fsck,
+                        fsck);
+        }
+
+        return 0;
+}
+
 static int add_mount(
                 const char *what,
                 const char *where,
@@ -162,6 +208,7 @@ static int add_mount(
                 *name = NULL, *unit = NULL, *lnk = NULL,
                 *automount_name = NULL, *automount_unit = NULL;
         _cleanup_fclose_ FILE *f = NULL;
+        int r;
         assert(what);
         assert(where);
@@ -209,32 +256,9 @@ static int add_mount(
                         "Before=%s\n",
                         post);
-        if (passno > 0) {
-                if (streq(where, "/")) {
-                        lnk = strjoin(arg_dest, "/", SPECIAL_LOCAL_FS_TARGET, ".wants/", "systemd-fsck-root.service", NULL);
-                        if (!lnk)
-                                return log_oom();
-
-                        mkdir_parents_label(lnk, 0755);
-                        if (symlink("systemd-fsck-root.service", lnk) < 0) {
-                                log_error("Failed to create symlink %s: %m", lnk);
-                                return -errno;
-                        }
-                } else {
-                        _cleanup_free_ char *fsck = NULL;
-
-                        fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
-                        if (!fsck)
-                                return log_oom();
-
-                        fprintf(f,
-                                "Requires=%s\n"
-                                "After=%s\n",
-                                fsck,
-                                fsck);
-                }
-        }
-
+        r = add_fsck(f, what, where, type, passno);
+        if (r < 0)
+                return r;
         fprintf(f,
                 "\n"
@@ -260,7 +284,6 @@ static int add_mount(
         if (!noauto) {
                 if (post) {
-                        free(lnk);
                         lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
                         if (!lnk)
                                 return log_oom();
SOURCES/0247-rules-60-persistent-storage-add-nvme-pcie-ssd-scsi_i.patch
New file
@@ -0,0 +1,24 @@
From 5d050e50b2028d3b29f2ecd7a6e5fe0ab543c1df Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Mon, 28 Jul 2014 16:31:32 +0200
Subject: [PATCH] rules/60-persistent-storage: add nvme pcie ssd scsi_id ENV
Resolves: #1042990
---
 rules/60-persistent-storage.rules | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
index a4d009a..c47c130 100644
--- a/rules/60-persistent-storage.rules
+++ b/rules/60-persistent-storage.rules
@@ -42,6 +42,9 @@ KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="s
 KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
 KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
+# NVMe
+KERNEL=="nvme*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode"
+
 # firewire
 KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}"
 KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n"
SOURCES/0248-cgls-fix-running-with-M-option.patch
New file
@@ -0,0 +1,166 @@
From 2b7fc0e2a0a680fe61041e569eda50f06c3f8768 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Mon, 28 Jul 2014 18:18:58 +0200
Subject: [PATCH] cgls: fix running with -M option
systemd-machined doesn't store cgroup path in a state file anymore.
Let's figure it out from the scope.
Resolves: #1085455
---
 Makefile.am     |  8 +++++-
 src/cgls/cgls.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 91 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index fa2fba6..a9fb792 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1830,8 +1830,14 @@ systemd_reply_password_LDADD = \
 systemd_cgls_SOURCES = \
     src/cgls/cgls.c
+systemd_cgls_CFLAGS = \
+    $(AM_CFLAGS) \
+    $(DBUS_CFLAGS)
+
 systemd_cgls_LDADD = \
-    libsystemd-shared.la
+    libsystemd-shared.la \
+    libsystemd-dbus.la \
+    libudev.la
 # ------------------------------------------------------------------------------
 systemd_cgtop_SOURCES = \
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index c689b5c..f678657 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -19,6 +19,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
+#include <dbus/dbus.h>
 #include <limits.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -35,6 +36,8 @@
 #include "build.h"
 #include "output-mode.h"
 #include "fileio.h"
+#include "dbus-common.h"
+#include "unit-name.h"
 static bool arg_no_pager = false;
 static bool arg_kernel_threads = false;
@@ -127,6 +130,10 @@ int main(int argc, char *argv[]) {
         int r = 0, retval = EXIT_FAILURE;
         int output_flags;
         char _cleanup_free_ *root = NULL;
+        DBusConnection *bus = NULL;
+        DBusError error;
+
+        dbus_error_init(&error);
         log_parse_environment();
         log_open();
@@ -147,6 +154,14 @@ int main(int argc, char *argv[]) {
                 }
         }
+        bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
+
+        if (!bus) {
+                printf("Failed to get D-Bus connection: %s", error.message);
+                retval = EXIT_FAILURE;
+                goto finish;
+        }
+
         output_flags =
                 arg_all * OUTPUT_SHOW_ALL |
                 (arg_full > 0) * OUTPUT_FULL_WIDTH;
@@ -189,8 +204,67 @@ int main(int argc, char *argv[]) {
                 } else {
                         if (arg_machine) {
                                 char *m;
+                                const char *cgroup;
+                                const char *property = "ControlGroup";
+                                const char *interface = "org.freedesktop.systemd1.Scope";
+                                _cleanup_free_ char *scope = NULL;
+                                _cleanup_free_ char *path = NULL;
+                                _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
+                                DBusMessageIter iter, sub;
+
                                 m = strappenda("/run/systemd/machines/", arg_machine);
-                                r = parse_env_file(m, NEWLINE, "CGROUP", &root, NULL);
+                                r = parse_env_file(m, NEWLINE, "SCOPE", &scope, NULL);
+
+                                if (r < 0) {
+                                        log_error("Failed to get machine path: %s", strerror(-r));
+                                        goto finish;
+                                }
+
+                                path = unit_dbus_path_from_name(scope);
+                                if (!path) {
+                                        r = log_oom();
+                                        goto finish;
+                                }
+
+                                r = bus_method_call_with_reply(
+                                                bus,
+                                                "org.freedesktop.systemd1",
+                                                path,
+                                                "org.freedesktop.DBus.Properties",
+                                                "Get",
+                                                &reply,
+                                                &error,
+                                                DBUS_TYPE_STRING, &interface,
+                                                DBUS_TYPE_STRING, &property,
+                                                DBUS_TYPE_INVALID);
+                                if (r < 0) {
+                                        log_error("Failed to query ControlGroup: %s", bus_error(&error, r));
+                                        dbus_error_free(&error);
+                                        goto finish;
+                                }
+
+                                if (!dbus_message_iter_init(reply, &iter) ||
+                                    dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) {
+                                        log_error("Failed to parse reply.");
+                                        r = -EINVAL;
+                                        goto finish;
+                                }
+
+                                dbus_message_iter_recurse(&iter, &sub);
+                                if (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_STRING) {
+                                        log_error("Failed to parse reply.");
+                                        r = -EINVAL;
+                                        goto finish;
+                                }
+
+                                dbus_message_iter_get_basic(&sub, &cgroup);
+
+                                root = strdup(cgroup);
+                                if (!root) {
+                                        r = log_oom();
+                                        goto finish;
+                                }
+
                         } else
                                 r = cg_get_root_path(&root);
                         if (r < 0) {
@@ -211,6 +285,15 @@ int main(int argc, char *argv[]) {
                 retval = EXIT_SUCCESS;
 finish:
+
+        if (bus) {
+                dbus_connection_flush(bus);
+                dbus_connection_close(bus);
+                dbus_connection_unref(bus);
+        }
+
+        dbus_error_free(&error);
+        dbus_shutdown();
         pager_close();
         return retval;
SOURCES/0249-units-when-spawning-a-getty-configure-TERM-explicitl.patch
New file
@@ -0,0 +1,60 @@
From fa600b8b075ad4c717bd5f60fd3c6b5545cc75c5 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 18 Dec 2013 17:48:31 +0100
Subject: [PATCH] units: when spawning a getty configure TERM explicitly
This way we can make use of our logic to automatically determine an
appropriate TERM for a specific tty.
Conflicts:
    units/console-getty.service.m4.in
    units/container-getty@.service.m4.in
(cherry picked from commit ccf22d4a104e6ed2666d6c5b4031981a84787790)
Related: #1075729
---
 units/console-getty.service.m4.in | 2 +-
 units/getty@.service.m4           | 2 +-
 units/serial-getty@.service.m4    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/units/console-getty.service.m4.in b/units/console-getty.service.m4.in
index 2fd9dd8..8ac51a4 100644
--- a/units/console-getty.service.m4.in
+++ b/units/console-getty.service.m4.in
@@ -15,7 +15,7 @@ After=rc-local.service
 Before=getty.target
 [Service]
-ExecStart=-/sbin/agetty --noclear -s console 115200,38400,9600
+ExecStart=-/sbin/agetty --noclear --keep-baud console 115200,38400,9600 $TERM
 Type=idle
 Restart=always
 RestartSec=0
diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
index 253da85..aa853b8 100644
--- a/units/getty@.service.m4
+++ b/units/getty@.service.m4
@@ -27,7 +27,7 @@ ConditionPathExists=/dev/tty0
 [Service]
 # the VT is cleared by TTYVTDisallocate
-ExecStart=-/sbin/agetty --noclear %I
+ExecStart=-/sbin/agetty --noclear %I $TERM
 Type=idle
 Restart=always
 RestartSec=0
diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
index aea078f..e94cdb4 100644
--- a/units/serial-getty@.service.m4
+++ b/units/serial-getty@.service.m4
@@ -22,7 +22,7 @@ Before=getty.target
 IgnoreOnIsolate=yes
 [Service]
-ExecStart=-/sbin/agetty --keep-baud %I 115200,38400,9600
+ExecStart=-/sbin/agetty --keep-baud %I 115200,38400,9600 $TERM
 Type=idle
 Restart=always
 RestartSec=0
SOURCES/0250-getty-Start-getty-on-3270-terminals-available-on-Lin.patch
New file
@@ -0,0 +1,84 @@
From 39456b9f6e692a2385bf1288a53d02dd9abac8d5 Mon Sep 17 00:00:00 2001
From: Hendrik Brueckner <brueckner@redhat.com>
Date: Tue, 11 Mar 2014 18:41:09 +0100
Subject: [PATCH] getty: Start getty on 3270 terminals available on Linux on
 System z
Add the first 3270 terminal device that is associated with the Linux preferred
console to the list of virtualization consoles.  This is required to
automatically start a getty if the conmode=3270 kernel parameter is specified
for Linux on z/VM instances.  Note that a queued upstream patch also enable
the 3270 terminal device if it is associated with the Linux preferred console.
How
To successfully start agetty on a 3270 terminal, a change in the agetty
parameter order is required.  Previously, agetty would started like this:
    /sbin/agetty --keep-baud 3270/tty1 115200,38400,9600 TERM
The agetty program interprets the "3270/tty1" as baud rate and fails to start
with the "bad speed: 3270/tty1" error message.  Fixing this in agetty is more
complex rather than reordering the command line parameters like this:
    /sbin/agetty --keep-baud 115200,38400,9600 3270/tty1 TERM
According to agetty sources and "agetty --help", agetty accepts the "tty",
"baudrate tty", and "tty baudrate" specifications.
P.S. The "tty: Set correct tty name in 'active' sysfs attribute" introduces
     a change to display the terminal device which is associated with the
     Linux preferred console.  This change helps to let systemd handle this
     particular case only.  Without the changes of this commit, no additional
     3270 terminal device can be managed by systemd.
     https://git.kernel.org/cgit/linux/kernel/git/gregkh/tty.git/commit/?id=723abd87f6e536f1353c8f64f621520bc29523a3
(cherry picked from commit fc6c7fe9becdd70ae6b671c396f2ad2db0b71cd7)
Resolves: #1075729
---
 rules/99-systemd.rules.in             | 2 +-
 src/getty-generator/getty-generator.c | 3 ++-
 units/serial-getty@.service.m4        | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
index 0471719..308a074 100644
--- a/rules/99-systemd.rules.in
+++ b/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"
 KERNEL=="vport*", TAG+="systemd"
diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c
index 40374b5..5a1997f 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -93,7 +93,8 @@ int main(int argc, char *argv[]) {
                 "xvc0\0"
                 "hvsi0\0"
                 "sclp_line0\0"
-                "ttysclp0\0";
+                "ttysclp0\0"
+                "3270!tty1\0";
         int r = EXIT_SUCCESS;
         char *active;
diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
index e94cdb4..4ac51e7 100644
--- a/units/serial-getty@.service.m4
+++ b/units/serial-getty@.service.m4
@@ -22,7 +22,7 @@ Before=getty.target
 IgnoreOnIsolate=yes
 [Service]
-ExecStart=-/sbin/agetty --keep-baud %I 115200,38400,9600 $TERM
+ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
 Type=idle
 Restart=always
 RestartSec=0
SOURCES/0251-core-Added-support-for-ERRNO-NOTIFY_SOCKET-message-p.patch
New file
@@ -0,0 +1,126 @@
From 4323a5406bb40c76076814fd998e09c58b433e7d Mon Sep 17 00:00:00 2001
From: Miguel Angel Ajo <mangelajo@redhat.com>
Date: Mon, 7 Jul 2014 14:20:36 +0200
Subject: [PATCH] core: Added support for ERRNO NOTIFY_SOCKET  message parsing
Added StatusErrno dbus property along StatusText to allow notification of
numeric status condition while degraded service operation or any other special
situation.
(cherry picked from commit 4774e357268e4a1e9fa82adb0563a538932a4c8e)
Resolves: #1106457
---
 src/core/dbus-service.c |  3 +++
 src/core/service.c      | 33 +++++++++++++++++++++++++++++----
 src/core/service.h      |  1 +
 3 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
index 696c446..edfc7ff 100644
--- a/src/core/dbus-service.c
+++ b/src/core/dbus-service.c
@@ -64,6 +64,7 @@
         "  <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
         "  <property name=\"BusName\" type=\"s\" access=\"read\"/>\n"   \
         "  <property name=\"StatusText\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"StatusErrno\" type=\"i\" access=\"read\"/>\n" \
         "  <property name=\"Result\" type=\"s\" access=\"read\"/>\n"    \
        " </interface>\n"
@@ -96,6 +97,7 @@ const char bus_service_invalidating_properties[] =
         "MainPID\0"
         "ControlPID\0"
         "StatusText\0"
+        "StatusErrno\0"
         "Result\0";
 static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_type, service_type, ServiceType);
@@ -144,6 +146,7 @@ static const BusProperty bus_service_properties[] = {
         { "ControlPID",             bus_property_append_pid,          "u", offsetof(Service, control_pid)                  },
         { "BusName",                bus_property_append_string,       "s", offsetof(Service, bus_name),               true },
         { "StatusText",             bus_property_append_string,       "s", offsetof(Service, status_text),            true },
+        { "StatusErrno",            bus_property_append_int,          "i", offsetof(Service, status_errno)                 },
         { "Result",                 bus_service_append_service_result,"s", offsetof(Service, result)                       },
         {}
 };
diff --git a/src/core/service.c b/src/core/service.c
index f6fdbbc..3f6c8ac 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -3443,6 +3443,7 @@ static void service_timer_event(Unit *u, uint64_t elapsed, Watch* w) {
 static void service_notify_message(Unit *u, pid_t pid, char **tags) {
         Service *s = SERVICE(u);
         const char *e;
+        bool notify_dbus = false;
         assert(u);
@@ -3478,6 +3479,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
                                        "%s: got %s", u->id, e);
                         service_set_main_pid(s, pid);
                         unit_watch_pid(UNIT(s), pid);
+                        notify_dbus = true;
                 }
         }
@@ -3516,12 +3518,34 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
                         free(s->status_text);
                         s->status_text = t;
-                } else {
+                } else
+                        t = NULL;
+
+                if (!streq_ptr(s->status_text, t)) {
                         free(s->status_text);
-                        s->status_text = NULL;
-                }
+                        s->status_text = t;
+                        notify_dbus = true;
+                } else
+                        free(t);
+        }
+
+        /* Interpret ERRNO= */
+        e = strv_find_prefix(tags, "ERRNO=");
+        if (e) {
+                int status_errno;
+                if (safe_atoi(e + 6, &status_errno) < 0)
+                        log_warning_unit(u->id, "Failed to parse ERRNO= field in notification message: %s", e);
+                else {
+                        log_debug_unit(u->id, "%s: got %s", u->id, e);
+
+                        if (s->status_errno != status_errno) {
+                                s->status_errno = status_errno;
+                                notify_dbus = true;
+                        }
+                }
         }
+
         if (strv_find(tags, "WATCHDOG=1")) {
                 log_debug_unit(u->id,
                                "%s: got WATCHDOG=1", u->id);
@@ -3530,7 +3554,8 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
         }
         /* Notify clients about changed status or main pid */
-        unit_add_to_dbus_queue(u);
+        if (notify_dbus)
+                unit_add_to_dbus_queue(u);
 }
 #ifdef HAVE_SYSV_COMPAT
diff --git a/src/core/service.h b/src/core/service.h
index ce5b5e0..fa4ef2b 100644
--- a/src/core/service.h
+++ b/src/core/service.h
@@ -187,6 +187,7 @@ struct Service {
         char *bus_name;
         char *status_text;
+        int status_errno;
         RateLimit start_limit;
         StartLimitAction start_limit_action;
SOURCES/0252-service-don-t-accept-negative-ERRNO-notification-mes.patch
New file
@@ -0,0 +1,25 @@
From 865e6e46f235bc9c58e61024696fff216e7a2182 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 7 Jul 2014 17:32:44 +0200
Subject: [PATCH] service: don't accept negative ERRNO= notification messages
(cherry picked from commit 2040ccf171404b709acb0ecf1d1f17b87c5d05f0)
Related: #1106457
---
 src/core/service.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/service.c b/src/core/service.c
index 3f6c8ac..814019d 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -3534,7 +3534,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
         if (e) {
                 int status_errno;
-                if (safe_atoi(e + 6, &status_errno) < 0)
+                if (safe_atoi(e + 6, &status_errno) < 0 || status_errno < 0)
                         log_warning_unit(u->id, "Failed to parse ERRNO= field in notification message: %s", e);
                 else {
                         log_debug_unit(u->id, "%s: got %s", u->id, e);
SOURCES/0253-socket-add-SocketUser-and-SocketGroup-for-chown-ing-.patch
File was renamed from SOURCES/0237-socket-add-SocketUser-and-SocketGroup-for-chown-ing-.patch
@@ -1,4 +1,4 @@
From efd4bdec3cd568439eb9b0f0a555b4016da12efe Mon Sep 17 00:00:00 2001
From 6744ef720b34a87ff69acb8535cf5e83db6f5e8b Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Tue, 24 Jun 2014 14:50:26 +0200
Subject: [PATCH] socket: add SocketUser= and SocketGroup= for chown()ing
SOURCES/0254-selinux-Check-access-vector-for-enable-and-disable-p.patch
New file
@@ -0,0 +1,83 @@
From 1ea0879cf79412e27b8becdb2bbc7e0abd301a66 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 12 Aug 2014 12:58:47 +0200
Subject: [PATCH] selinux: Check access vector for enable and disable perm for
 each unit file
---
 src/core/dbus-manager.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 6d16c2a..cebc730 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1581,6 +1581,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                    dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "SetDefaultTarget")) {
                 char **l = NULL;
+                char **i;
                 DBusMessageIter iter;
                 UnitFileScope scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
                 UnitFileChange *changes = NULL;
@@ -1588,8 +1589,6 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                 dbus_bool_t runtime, force;
                 int carries_install_info = -1;
-                SELINUX_ACCESS_CHECK(connection, message, streq(member, "MaskUnitFiles") ? "disable" : "enable");
-
                 if (!dbus_message_iter_init(message, &iter))
                         goto oom;
@@ -1601,6 +1600,17 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                         return bus_send_error_reply(connection, message, NULL, r);
                 }
+                STRV_FOREACH(i, l) {
+                        Unit *u;
+
+                        r = manager_load_unit(m, *i, NULL, NULL, &u);
+                        if (r < 0) {
+                                dbus_set_error(&error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s does not exist.", *i);
+                                return bus_send_error_reply(connection, message, &error, -ENOENT);
+                        }
+                        SELINUX_UNIT_ACCESS_CHECK(u, connection, message, streq(member, "MaskUnitFiles") ? "disable" : "enable");
+                }
+
                 if (!dbus_message_iter_next(&iter) ||
                     bus_iter_get_basic_and_next(&iter, DBUS_TYPE_BOOLEAN, &runtime, true) < 0 ||
                     bus_iter_get_basic_and_next(&iter, DBUS_TYPE_BOOLEAN, &force, false) < 0) {
@@ -1644,14 +1654,13 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                    dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "UnmaskUnitFiles")) {
                 char **l = NULL;
+                char **i;
                 DBusMessageIter iter;
                 UnitFileScope scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER;
                 UnitFileChange *changes = NULL;
                 unsigned n_changes = 0;
                 dbus_bool_t runtime;
-                SELINUX_ACCESS_CHECK(connection, message, streq(member, "UnmaskUnitFiles") ? "enable" : "disable");
-
                 if (!dbus_message_iter_init(message, &iter))
                         goto oom;
@@ -1669,6 +1678,17 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                         return bus_send_error_reply(connection, message, NULL, -EIO);
                 }
+                STRV_FOREACH(i, l) {
+                        Unit *u;
+
+                        r = manager_load_unit(m, *i, NULL, NULL, &u);
+                        if (r < 0) {
+                                dbus_set_error(&error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s does not exist.", *i);
+                                return bus_send_error_reply(connection, message, &error, -ENOENT);
+                        }
+                        SELINUX_UNIT_ACCESS_CHECK(u, connection, message, streq(member, "UnmaskUnitFiles") ? "enable" : "disable");
+                }
+
                 if (streq(member, "DisableUnitFiles"))
                         r = unit_file_disable(scope, runtime, NULL, l, &changes, &n_changes);
                 else if (streq(member, "UnmaskUnitFiles"))
SOURCES/0255-systemctl-show-StatusErrno-value-in-systemctl-status.patch
New file
@@ -0,0 +1,45 @@
From eb075b31eb70910508309c6319d0cc37d454ff59 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 7 Jul 2014 17:33:26 +0200
Subject: [PATCH] systemctl: show StatusErrno value in "systemctl status"
(cherry picked from commit b4af5a803aa71a57733ca46fef29b7afb20a626c)
Conflicts:
        src/systemctl/systemctl.c
Related: #1106457
---
 src/systemctl/systemctl.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index d29133c..c738daf 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2480,6 +2480,7 @@ typedef struct UnitStatusInfo {
         const char *status_text;
         const char *pid_file;
         bool running:1;
+        int status_errno;
         usec_t start_timestamp;
         usec_t exit_timestamp;
@@ -2751,6 +2752,8 @@ static void print_status_info(UnitStatusInfo *i,
         if (i->status_text)
                 printf("   Status: \"%s\"\n", i->status_text);
+        if (i->status_errno > 0)
+                printf("   Error: %i (%s)\n", i->status_errno, strerror(i->status_errno));
         if (i->control_group &&
             (i->main_pid > 0 || i->control_pid > 0 || cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, i->control_group, false) == 0)) {
@@ -2963,6 +2966,8 @@ static int status_property(const char *name, DBusMessageIter *iter, UnitStatusIn
                         i->exit_code = (int) j;
                 else if (streq(name, "ExecMainStatus"))
                         i->exit_status = (int) j;
+                else if (streq(name, "StatusErrno"))
+                        i->status_errno = (int) j;
                 break;
         }
SOURCES/0256-service-flush-status-text-and-errno-values-each-time.patch
New file
@@ -0,0 +1,30 @@
From 5078832417b89cfe92ad87133ecb4179a995db31 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 7 Jul 2014 17:33:46 +0200
Subject: [PATCH] service: flush status text and errno values each time a
 service is started
We shouldn't show status texts from previous service starts
(cherry picked from commit 8cfdb077b8e3da1c47fc1d735d051f21f33144c1)
Related: #1106457
---
 src/core/service.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/src/core/service.c b/src/core/service.c
index 814019d..a6d046c 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2579,6 +2579,10 @@ static int service_start(Unit *u) {
         s->main_pid_alien = false;
         s->forbid_restart = false;
+        free(s->status_text);
+        s->status_text = NULL;
+        s->status_errno = 0;
+
         service_enter_start_pre(s);
         return 0;
 }
SOURCES/0257-service-don-t-free-status_text-twice.patch
New file
@@ -0,0 +1,24 @@
From 3b6a01f5fc0a4770d9c55a1c7fb1addc231f3021 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 18 Aug 2014 16:12:45 +0200
Subject: [PATCH] service: don't free status_text twice
Related: #1106457
---
 src/core/service.c | 3 ---
 1 file changed, 3 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index a6d046c..4366e1b 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -3519,9 +3519,6 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
                         log_debug_unit(u->id,
                                        "%s: got %s", u->id, e);
-
-                        free(s->status_text);
-                        s->status_text = t;
                 } else
                         t = NULL;
SOURCES/0258-util-add-files_same-helper-function.patch
New file
@@ -0,0 +1,71 @@
From b6fbffe3d4a9435cc8560ee0271c7e6e763e89c1 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 6 Mar 2014 09:12:57 +0100
Subject: [PATCH] util: add files_same() helper function
files_same() returns
     1, if the files are the same
     0, if the files have different inode/dev numbers
 errno, for any stat error
 (cherry picked from commit 9d9951a460a90ef0e1e0384742cefdcf85193f8c)
 Related: #1111199
---
 src/shared/util.c | 24 ++++++++++++++++--------
 src/shared/util.h |  2 ++
 2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index 2974c2a..fb1e6d1 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3311,19 +3311,27 @@ bool on_tty(void) {
         return cached_on_tty;
 }
-int running_in_chroot(void) {
-        struct stat a = {}, b = {};
+int files_same(const char *filea, const char *fileb) {
+        struct stat a, b;
-        /* Only works as root */
-        if (stat("/proc/1/root", &a) < 0)
+        if (stat(filea, &a) < 0)
                 return -errno;
-        if (stat("/", &b) < 0)
+        if (stat(fileb, &b) < 0)
                 return -errno;
-        return
-                a.st_dev != b.st_dev ||
-                a.st_ino != b.st_ino;
+        return a.st_dev == b.st_dev &&
+               a.st_ino == b.st_ino;
+}
+
+int running_in_chroot(void) {
+        int ret;
+
+        ret = files_same("/proc/1/root", "/");
+        if (ret < 0)
+                return ret;
+
+        return ret == 0;
 }
 char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent) {
diff --git a/src/shared/util.h b/src/shared/util.h
index e577ef0..631a385 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -403,6 +403,8 @@ static inline const char *ansi_highlight_off(void) {
         return on_tty() ? ANSI_HIGHLIGHT_OFF : "";
 }
+int files_same(const char *filea, const char *fileb);
+
 int running_in_chroot(void);
 char *ellipsize(const char *s, size_t length, unsigned percent);
SOURCES/0259-systemctl-for-switch-root-check-if-we-switch-to-a-sy.patch
New file
@@ -0,0 +1,109 @@
From cad8ec5980d63253586d9f884649c45eed0667a1 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 6 Mar 2014 16:35:02 +0100
Subject: [PATCH] systemctl: for switch-root check, if we switch to a systemd
 init
If "systemctl switch-root" is called with a specific "INIT" or
/proc/cmdline contains "init=", then systemd would not serialize
itsself.
Let systemctl check, if the new init is in the standard systemd
installation path and if so, clear the INIT parameter,
to let systemd serialize itsself.
Conflicts:
    src/systemctl/systemctl.c
(cherry picked from commit f39d4a08e746e703d562076a0f622eb91dbdcd3e)
Related: #1111199
---
 src/shared/util.h         | 13 +++++++++++++
 src/systemctl/systemctl.c | 35 ++++++++++++++++++++++++++---------
 2 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/src/shared/util.h b/src/shared/util.h
index 631a385..d11fa07 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -726,6 +726,19 @@ int unlink_noerrno(const char *path);
                 _c_;                                    \
         })
+#define strappenda3(a, b, c)                                    \
+        ({                                                      \
+                const char *_a_ = (a), *_b_ = (b), *_c_ = (c);  \
+                char *_d_;                                      \
+                size_t _x_, _y_, _z_;                           \
+                _x_ = strlen(_a_);                              \
+                _y_ = strlen(_b_);                              \
+                _z_ = strlen(_c_);                              \
+                _d_ = alloca(_x_ + _y_ + _z_ + 1);              \
+                strcpy(stpcpy(stpcpy(_d_, _a_), _b_), _c_);     \
+                _d_;                                            \
+        })
+
 #define procfs_file_alloca(pid, field)                                  \
         ({                                                              \
                 pid_t _pid_ = (pid);                                    \
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index c738daf..1ca4fd3 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4143,9 +4143,10 @@ static int show_enviroment(DBusConnection *bus, char **args) {
 }
 static int switch_root(DBusConnection *bus, char **args) {
+        _cleanup_free_ char *cmdline_init = NULL;
+        const char *root, *init;
         unsigned l;
-        const char *root;
-        _cleanup_free_ char *init = NULL;
+        int r;
         l = strv_length(args);
         if (l < 2 || l > 3) {
@@ -4156,19 +4157,35 @@ static int switch_root(DBusConnection *bus, char **args) {
         root = args[1];
         if (l >= 3)
-                init = strdup(args[2]);
+                init = args[2];
         else {
-                parse_env_file("/proc/cmdline", WHITESPACE,
-                               "init", &init,
-                               NULL);
+                r = parse_env_file("/proc/cmdline", WHITESPACE,
+                                   "init", &cmdline_init,
+                                   NULL);
+                if (r < 0)
+                        log_debug("Failed to parse /proc/cmdline: %s", strerror(-r));
-                if (!init)
-                        init = strdup("");
+                init = cmdline_init;
         }
         if (!init)
                 return log_oom();
-        log_debug("switching root - root: %s; init: %s", root, init);
+        if (isempty(init))
+                init = NULL;
+
+        if (init) {
+                const char *root_systemd_path = NULL, *root_init_path = NULL;
+
+                root_systemd_path = strappenda(root, "/" SYSTEMD_BINARY_PATH);
+                root_init_path = strappenda3(root, "/", init);
+
+                /* If the passed init is actually the same as the
+                 * systemd binary, then let's suppress it. */
+                if (files_same(root_init_path, root_systemd_path) > 0)
+                        init = NULL;
+        }
+
+        log_debug("Switching root - root: %s; init: %s", root, strna(init));
         return bus_method_call_with_reply(
                         bus,
SOURCES/0260-shared-include-root-when-canonicalizing-conf-paths.patch
New file
@@ -0,0 +1,197 @@
From b7f7813318b370d9ecf3833f92c5258d362d9441 Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
Date: Fri, 31 Jan 2014 15:35:04 -0800
Subject: [PATCH] shared: include root when canonicalizing conf paths
The conf_files_list family accepts an alternate root path to prefix all
directories in the list but path_strv_canonicalize_uniq doesn't use it.
This results in the suspicious behavior of resolving directory symlinks
based on the contents of / instead of the alternate root.
This adds a prefix argument to path_strv_canonicalize which will now
prepend the prefix, if given, to every path in the list. To avoid
answering what a relative path means when called with a root prefix
path_strv_canonicalize is now path_strv_canonicalize_absolute and only
considers absolute paths. Fortunately all users of already call
path_strv_canonicalize with a list of absolute paths.
(cherry picked from commit 112cfb181453e38d3ef4a74fba23abbb53392002)
Related: #1111199
---
 src/shared/conf-files.c  | 10 +++-------
 src/shared/path-lookup.c |  6 +++---
 src/shared/path-util.c   | 29 +++++++++++++++++++----------
 src/shared/path-util.h   |  4 ++--
 src/shared/util.c        |  2 +-
 src/udev/udev-rules.c    |  2 +-
 6 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index ed4070c..3d5b1df 100644
--- a/src/shared/conf-files.c
+++ b/src/shared/conf-files.c
@@ -37,12 +37,8 @@
 #include "hashmap.h"
 #include "conf-files.h"
-static int files_add(Hashmap *h, const char *root, const char *path, const char *suffix) {
+static int files_add(Hashmap *h, const char *dirpath, const char *suffix) {
         _cleanup_closedir_ DIR *dir = NULL;
-        _cleanup_free_ char *dirpath = NULL;
-
-        if (asprintf(&dirpath, "%s%s", root ? root : "", path) < 0)
-                return -ENOMEM;
         dir = opendir(dirpath);
         if (!dir) {
@@ -104,7 +100,7 @@ static int conf_files_list_strv_internal(char ***strv, const char *suffix, const
         assert(suffix);
         /* This alters the dirs string array */
-        if (!path_strv_canonicalize_uniq(dirs))
+        if (!path_strv_canonicalize_absolute_uniq(dirs, root))
                 return -ENOMEM;
         fh = hashmap_new(string_hash_func, string_compare_func);
@@ -112,7 +108,7 @@ static int conf_files_list_strv_internal(char ***strv, const char *suffix, const
                 return -ENOMEM;
         STRV_FOREACH(p, dirs) {
-                r = files_add(fh, root, *p, suffix);
+                r = files_add(fh, *p, suffix);
                 if (r == -ENOMEM) {
                         hashmap_free_free(fh);
                         return r;
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 1a47ea9..03c1380 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -316,7 +316,7 @@ int lookup_paths_init(
                 }
         }
-        if (!path_strv_canonicalize(p->unit_path))
+        if (!path_strv_canonicalize_absolute(p->unit_path, NULL))
                 return -ENOMEM;
         strv_uniq(p->unit_path);
@@ -372,10 +372,10 @@ int lookup_paths_init(
                                 return -ENOMEM;
                 }
-                if (!path_strv_canonicalize(p->sysvinit_path))
+                if (!path_strv_canonicalize_absolute(p->sysvinit_path, NULL))
                         return -ENOMEM;
-                if (!path_strv_canonicalize(p->sysvrcnd_path))
+                if (!path_strv_canonicalize_absolute(p->sysvrcnd_path, NULL))
                         return -ENOMEM;
                 strv_uniq(p->sysvinit_path);
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index 45099ee..de291a5 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -165,7 +165,7 @@ char **path_strv_make_absolute_cwd(char **l) {
         return l;
 }
-char **path_strv_canonicalize(char **l) {
+char **path_strv_canonicalize_absolute(char **l, const char *prefix) {
         char **s;
         unsigned k = 0;
         bool enomem = false;
@@ -180,13 +180,21 @@ char **path_strv_canonicalize(char **l) {
         STRV_FOREACH(s, l) {
                 char *t, *u;
-                t = path_make_absolute_cwd(*s);
-                free(*s);
-                *s = NULL;
-
-                if (!t) {
-                        enomem = true;
+                if (!path_is_absolute(*s))
                         continue;
+
+                if (prefix) {
+                        t = strappend(prefix, *s);
+                        free(*s);
+                        *s = NULL;
+
+                        if (!t) {
+                                enomem = true;
+                                continue;
+                        }
+                } else {
+                        t = *s;
+                        *s = NULL;
                 }
                 errno = 0;
@@ -196,7 +204,7 @@ char **path_strv_canonicalize(char **l) {
                                 u = t;
                         else {
                                 free(t);
-                                if (errno == ENOMEM || !errno)
+                                if (errno == ENOMEM || errno == 0)
                                         enomem = true;
                                 continue;
@@ -215,11 +223,12 @@ char **path_strv_canonicalize(char **l) {
         return l;
 }
-char **path_strv_canonicalize_uniq(char **l) {
+char **path_strv_canonicalize_absolute_uniq(char **l, const char *prefix) {
+
         if (strv_isempty(l))
                 return l;
-        if (!path_strv_canonicalize(l))
+        if (!path_strv_canonicalize_absolute(l, prefix))
                 return NULL;
         return strv_uniq(l);
diff --git a/src/shared/path-util.h b/src/shared/path-util.h
index 0a42de7..c69cd1f 100644
--- a/src/shared/path-util.h
+++ b/src/shared/path-util.h
@@ -43,8 +43,8 @@ char* path_startswith(const char *path, const char *prefix) _pure_;
 bool path_equal(const char *a, const char *b) _pure_;
 char** path_strv_make_absolute_cwd(char **l);
-char** path_strv_canonicalize(char **l);
-char** path_strv_canonicalize_uniq(char **l);
+char** path_strv_canonicalize_absolute(char **l, const char *prefix);
+char** path_strv_canonicalize_absolute_uniq(char **l, const char *prefix);
 int path_is_mount_point(const char *path, bool allow_symlink);
 int path_is_read_only_fs(const char *path);
diff --git a/src/shared/util.c b/src/shared/util.c
index fb1e6d1..a5163fb 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5681,7 +5681,7 @@ static int search_and_fopen_internal(const char *path, const char *mode, char **
         assert(mode);
         assert(_f);
-        if (!path_strv_canonicalize_uniq(search))
+        if (!path_strv_canonicalize_absolute_uniq(search, NULL))
                 return -ENOMEM;
         STRV_FOREACH(i, search) {
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 6f8b127..9092b08 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1630,7 +1630,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
                 log_error("failed to build config directory array");
                 return udev_rules_unref(rules);
         }
-        if (!path_strv_canonicalize(rules->dirs)) {
+        if (!path_strv_canonicalize_absolute(rules->dirs, NULL)) {
                 log_error("failed to canonicalize config directories\n");
                 return udev_rules_unref(rules);
         }
SOURCES/0261-shared-add-root-argument-to-search_and_fopen.patch
New file
@@ -0,0 +1,144 @@
From 123a76e6190cb2a4669d39e12983f46e27b11163 Mon Sep 17 00:00:00 2001
From: Michael Marineau <michael.marineau@coreos.com>
Date: Thu, 13 Mar 2014 21:32:12 -0700
Subject: [PATCH] shared: add root argument to search_and_fopen
This adds the same root argument to search_and_fopen that
conf_files_list already has. Tools that use those two functions as a
pair can now be easily modified to load configuration files from an
alternate root filesystem tree.
Conflicts:
    src/shared/util.h
(cherry picked from commit 4cf7ea556aa1e74f9b34d4467f36d46a1bb25da3)
Related: #1111199
---
 src/binfmt/binfmt.c             |  2 +-
 src/modules-load/modules-load.c |  2 +-
 src/shared/util.c               | 12 ++++++------
 src/shared/util.h               |  4 ++--
 src/sysctl/sysctl.c             |  2 +-
 src/tmpfiles/tmpfiles.c         |  2 +-
 6 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
index 5a42b3d..3fff89a 100644
--- a/src/binfmt/binfmt.c
+++ b/src/binfmt/binfmt.c
@@ -85,7 +85,7 @@ static int apply_file(const char *path, bool ignore_enoent) {
         assert(path);
-        r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f);
+        r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f);
         if (r < 0) {
                 if (ignore_enoent && r == -ENOENT)
                         return 0;
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index 49ee420..cba7c55 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -181,7 +181,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent
         assert(ctx);
         assert(path);
-        r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f);
+        r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f);
         if (r < 0) {
                 if (ignore_enoent && r == -ENOENT)
                         return 0;
diff --git a/src/shared/util.c b/src/shared/util.c
index a5163fb..e313ea9 100644