Add sys-apps/systemd with musl libc patches
This commit is contained in:
parent
d3652b8636
commit
fc21c2e97e
|
@ -0,0 +1 @@
|
||||||
|
DIST systemd-stable-245.5.tar.gz 9020836 SHA256 b754d75617665a53bd0a1e8f5ec526b383f17e1cc06d1056399e5859e0b6fe06 SHA512 47de4a59980643002f325c499eeb4dd76fa9f1d1267686e7564f103690487bf85974590d7cb3e3641409e5bfba567fe2a66efa80320e7e8adc48af4461e2e172 WHIRLPOOL 5f045e3fdfefb982ed81fac031cadfaa64eaa52e3a8c7c40279abd4934770143fc997c7da6eb1737a73d12284b5b6088fa045595bd4947d3eae2445035cf7f2e
|
|
@ -0,0 +1,171 @@
|
||||||
|
From ef9580ea1e2f1e57af3c7dcb0ec392ba8dbb5c8d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alex Kiernan <alex.kiernan@gmail.com>
|
||||||
|
Date: Tue, 10 Mar 2020 11:05:20 +0000
|
||||||
|
Subject: [PATCH] Handle missing gshadow
|
||||||
|
|
||||||
|
gshadow usage is now present in the userdb code. Mask all uses of it to
|
||||||
|
allow compilation on musl
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||||
|
---
|
||||||
|
src/shared/group-record-nss.c | 20 ++++++++++++++++++++
|
||||||
|
src/shared/group-record-nss.h | 4 ++++
|
||||||
|
src/shared/userdb.c | 6 ++++++
|
||||||
|
3 files changed, 30 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/shared/group-record-nss.c b/src/shared/group-record-nss.c
|
||||||
|
index 77924f1c4067..c64490253ff3 100644
|
||||||
|
--- a/src/shared/group-record-nss.c
|
||||||
|
+++ b/src/shared/group-record-nss.c
|
||||||
|
@@ -19,8 +19,10 @@ int nss_group_to_group_record(
|
||||||
|
if (isempty(grp->gr_name))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
+#if ENABLE_GSHADOW
|
||||||
|
if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
|
||||||
|
return -EINVAL;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
g = group_record_new();
|
||||||
|
if (!g)
|
||||||
|
@@ -36,6 +38,7 @@ int nss_group_to_group_record(
|
||||||
|
|
||||||
|
g->gid = grp->gr_gid;
|
||||||
|
|
||||||
|
+#if ENABLE_GSHADOW
|
||||||
|
if (sgrp) {
|
||||||
|
if (hashed_password_valid(sgrp->sg_passwd)) {
|
||||||
|
g->hashed_password = strv_new(sgrp->sg_passwd);
|
||||||
|
@@ -51,6 +54,7 @@ int nss_group_to_group_record(
|
||||||
|
if (!g->administrators)
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
r = json_build(&g->json, JSON_BUILD_OBJECT(
|
||||||
|
JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
|
||||||
|
@@ -76,6 +80,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
|
||||||
|
assert(ret_sgrp);
|
||||||
|
assert(ret_buffer);
|
||||||
|
|
||||||
|
+#if ENABLE_GSHADOW
|
||||||
|
for (;;) {
|
||||||
|
_cleanup_free_ char *buf = NULL;
|
||||||
|
struct sgrp sgrp, *result;
|
||||||
|
@@ -104,6 +109,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
|
||||||
|
buflen *= 2;
|
||||||
|
buf = mfree(buf);
|
||||||
|
}
|
||||||
|
+#else
|
||||||
|
+ return -ESRCH;
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int nss_group_record_by_name(const char *name, GroupRecord **ret) {
|
||||||
|
@@ -111,7 +119,9 @@ int nss_group_record_by_name(const char *name, GroupRecord **ret) {
|
||||||
|
struct group grp, *result;
|
||||||
|
bool incomplete = false;
|
||||||
|
size_t buflen = 4096;
|
||||||
|
+#if ENABLE_GSHADOW
|
||||||
|
struct sgrp sgrp;
|
||||||
|
+#endif
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(name);
|
||||||
|
@@ -141,6 +151,7 @@ int nss_group_record_by_name(const char *name, GroupRecord **ret) {
|
||||||
|
buf = mfree(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if ENABLE_GSHADOW
|
||||||
|
r = nss_sgrp_for_group(result, &sgrp, &sbuf);
|
||||||
|
if (r < 0) {
|
||||||
|
log_debug_errno(r, "Failed to do shadow lookup for group %s, ignoring: %m", result->gr_name);
|
||||||
|
@@ -148,6 +159,9 @@ int nss_group_record_by_name(const char *name, GroupRecord **ret) {
|
||||||
|
}
|
||||||
|
|
||||||
|
r = nss_group_to_group_record(result, r >= 0 ? &sgrp : NULL, ret);
|
||||||
|
+#else
|
||||||
|
+ r = nss_group_to_group_record(result, NULL, ret);
|
||||||
|
+#endif
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
@@ -160,7 +174,9 @@ int nss_group_record_by_gid(gid_t gid, GroupRecord **ret) {
|
||||||
|
struct group grp, *result;
|
||||||
|
bool incomplete = false;
|
||||||
|
size_t buflen = 4096;
|
||||||
|
+#if ENABLE_GSHADOW
|
||||||
|
struct sgrp sgrp;
|
||||||
|
+#endif
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(ret);
|
||||||
|
@@ -188,6 +204,7 @@ int nss_group_record_by_gid(gid_t gid, GroupRecord **ret) {
|
||||||
|
buf = mfree(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if ENABLE_GSHADOW
|
||||||
|
r = nss_sgrp_for_group(result, &sgrp, &sbuf);
|
||||||
|
if (r < 0) {
|
||||||
|
log_debug_errno(r, "Failed to do shadow lookup for group %s, ignoring: %m", result->gr_name);
|
||||||
|
@@ -195,6 +212,9 @@ int nss_group_record_by_gid(gid_t gid, GroupRecord **ret) {
|
||||||
|
}
|
||||||
|
|
||||||
|
r = nss_group_to_group_record(result, r >= 0 ? &sgrp : NULL, ret);
|
||||||
|
+#else
|
||||||
|
+ r = nss_group_to_group_record(result, NULL, ret);
|
||||||
|
+#endif
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
diff --git a/src/shared/group-record-nss.h b/src/shared/group-record-nss.h
|
||||||
|
index 38b2995178ff..d7d95c44cf11 100644
|
||||||
|
--- a/src/shared/group-record-nss.h
|
||||||
|
+++ b/src/shared/group-record-nss.h
|
||||||
|
@@ -2,7 +2,11 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <grp.h>
|
||||||
|
+#if ENABLE_GSHADOW
|
||||||
|
#include <gshadow.h>
|
||||||
|
+#else
|
||||||
|
+struct sgrp;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "group-record.h"
|
||||||
|
|
||||||
|
diff --git a/src/shared/userdb.c b/src/shared/userdb.c
|
||||||
|
index 92f8796768d7..5d912862f85c 100644
|
||||||
|
--- a/src/shared/userdb.c
|
||||||
|
+++ b/src/shared/userdb.c
|
||||||
|
@@ -924,13 +924,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
|
||||||
|
if (gr) {
|
||||||
|
_cleanup_free_ char *buffer = NULL;
|
||||||
|
bool incomplete = false;
|
||||||
|
+#if ENABLE_GSHADOW
|
||||||
|
struct sgrp sgrp;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
if (streq_ptr(gr->gr_name, "root"))
|
||||||
|
iterator->synthesize_root = false;
|
||||||
|
if (gr->gr_gid == GID_NOBODY)
|
||||||
|
iterator->synthesize_nobody = false;
|
||||||
|
|
||||||
|
+#if ENABLE_GSHADOW
|
||||||
|
r = nss_sgrp_for_group(gr, &sgrp, &buffer);
|
||||||
|
if (r < 0) {
|
||||||
|
log_debug_errno(r, "Failed to acquire shadow entry for group %s, ignoring: %m", gr->gr_name);
|
||||||
|
@@ -938,6 +941,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
|
||||||
|
}
|
||||||
|
|
||||||
|
r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
|
||||||
|
+#else
|
||||||
|
+ r = nss_group_to_group_record(gr, NULL, ret);
|
||||||
|
+#endif
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
From 564830719be2017c4953589d50f21a9e856a4ecc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Thu, 21 Feb 2019 16:23:24 +0800
|
||||||
|
Subject: [PATCH] binfmt: Don't install dependency links at install time for
|
||||||
|
the binfmt services
|
||||||
|
|
||||||
|
use [Install] blocks so that they get created when the service is enabled
|
||||||
|
like a traditional service.
|
||||||
|
|
||||||
|
The [Install] blocks were rejected upstream as they don't have a way to
|
||||||
|
"enable" it on install without static symlinks which can't be disabled,
|
||||||
|
only masked. We however can do that in a postinst.
|
||||||
|
|
||||||
|
Upstream-Status: Denied
|
||||||
|
|
||||||
|
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
[rebased for systemd 243]
|
||||||
|
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
units/meson.build | 6 ++----
|
||||||
|
units/proc-sys-fs-binfmt_misc.automount | 3 +++
|
||||||
|
units/systemd-binfmt.service.in | 4 ++++
|
||||||
|
3 files changed, 9 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/units/meson.build b/units/meson.build
|
||||||
|
index ea91f0cc9ea7..25186f88dfeb 100644
|
||||||
|
--- a/units/meson.build
|
||||||
|
+++ b/units/meson.build
|
||||||
|
@@ -52,8 +52,7 @@ units = [
|
||||||
|
['poweroff.target', '',
|
||||||
|
'runlevel0.target'],
|
||||||
|
['printer.target', ''],
|
||||||
|
- ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT',
|
||||||
|
- 'sysinit.target.wants/'],
|
||||||
|
+ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'],
|
||||||
|
['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'],
|
||||||
|
['reboot.target', '',
|
||||||
|
'runlevel6.target ctrl-alt-del.target'],
|
||||||
|
@@ -161,8 +160,7 @@ in_units = [
|
||||||
|
['rc-local.service', 'HAVE_SYSV_COMPAT'],
|
||||||
|
['rescue.service', ''],
|
||||||
|
['systemd-backlight@.service', 'ENABLE_BACKLIGHT'],
|
||||||
|
- ['systemd-binfmt.service', 'ENABLE_BINFMT',
|
||||||
|
- 'sysinit.target.wants/'],
|
||||||
|
+ ['systemd-binfmt.service', 'ENABLE_BINFMT'],
|
||||||
|
['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'],
|
||||||
|
['systemd-boot-check-no-failures.service', ''],
|
||||||
|
['systemd-coredump@.service', 'ENABLE_COREDUMP'],
|
||||||
|
diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
|
||||||
|
index 30a6bc991844..4231f3b70fe9 100644
|
||||||
|
--- a/units/proc-sys-fs-binfmt_misc.automount
|
||||||
|
+++ b/units/proc-sys-fs-binfmt_misc.automount
|
||||||
|
@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/
|
||||||
|
|
||||||
|
[Automount]
|
||||||
|
Where=/proc/sys/fs/binfmt_misc
|
||||||
|
+
|
||||||
|
+[Install]
|
||||||
|
+WantedBy=sysinit.target
|
||||||
|
diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
|
||||||
|
index e54e95e11d5d..372a598614d3 100644
|
||||||
|
--- a/units/systemd-binfmt.service.in
|
||||||
|
+++ b/units/systemd-binfmt.service.in
|
||||||
|
@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.htm
|
||||||
|
Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
|
||||||
|
DefaultDependencies=no
|
||||||
|
Conflicts=shutdown.target
|
||||||
|
+Wants=proc-sys-fs-binfmt_misc.automount
|
||||||
|
After=proc-sys-fs-binfmt_misc.automount
|
||||||
|
After=proc-sys-fs-binfmt_misc.mount
|
||||||
|
Before=sysinit.target shutdown.target
|
||||||
|
@@ -30,3 +31,6 @@ RemainAfterExit=yes
|
||||||
|
ExecStart=@rootlibexecdir@/systemd-binfmt
|
||||||
|
ExecStop=@rootlibexecdir@/systemd-binfmt --unregister
|
||||||
|
TimeoutSec=90s
|
||||||
|
+
|
||||||
|
+[Install]
|
||||||
|
+WantedBy=sysinit.target
|
|
@ -0,0 +1,411 @@
|
||||||
|
From f92fd7e77ed5aab2dda01a20e6891c37f09415d3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Fri, 1 Mar 2019 15:22:15 +0800
|
||||||
|
Subject: [PATCH] do not disable buffer in writing files
|
||||||
|
|
||||||
|
Do not disable buffer in writing files, otherwise we get
|
||||||
|
failure at boot for musl like below.
|
||||||
|
|
||||||
|
[!!!!!!] Failed to allocate manager object.
|
||||||
|
|
||||||
|
And there will be other failures, critical or not critical.
|
||||||
|
This is specific to musl.
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl]
|
||||||
|
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
[Rebased for v242]
|
||||||
|
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||||
|
[rebased for systemd 243]
|
||||||
|
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/cgroup-util.c | 10 +++++-----
|
||||||
|
src/basic/procfs-util.c | 4 ++--
|
||||||
|
src/basic/smack-util.c | 2 +-
|
||||||
|
src/basic/util.c | 2 +-
|
||||||
|
src/binfmt/binfmt.c | 6 +++---
|
||||||
|
src/core/main.c | 4 ++--
|
||||||
|
src/core/smack-setup.c | 8 ++++----
|
||||||
|
src/hibernate-resume/hibernate-resume.c | 2 +-
|
||||||
|
src/libsystemd/sd-device/sd-device.c | 2 +-
|
||||||
|
src/login/logind-dbus.c | 2 +-
|
||||||
|
src/nspawn/nspawn-cgroup.c | 2 +-
|
||||||
|
src/nspawn/nspawn.c | 6 +++---
|
||||||
|
src/shared/cgroup-setup.c | 4 ++--
|
||||||
|
src/shared/sysctl-util.c | 2 +-
|
||||||
|
src/sleep/sleep.c | 8 ++++----
|
||||||
|
src/udev/udevadm-trigger.c | 2 +-
|
||||||
|
src/udev/udevd.c | 2 +-
|
||||||
|
src/vconsole/vconsole-setup.c | 2 +-
|
||||||
|
18 files changed, 35 insertions(+), 35 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
|
||||||
|
index a5141f4cbedd..04c06e7a55cb 100644
|
||||||
|
--- a/src/basic/cgroup-util.c
|
||||||
|
+++ b/src/basic/cgroup-util.c
|
||||||
|
@@ -739,7 +739,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
|
||||||
|
|
||||||
|
sc = strstrip(contents);
|
||||||
|
if (isempty(sc)) {
|
||||||
|
- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file(fs, agent, 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
} else if (!path_equal(sc, agent))
|
||||||
|
@@ -757,7 +757,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
|
||||||
|
|
||||||
|
sc = strstrip(contents);
|
||||||
|
if (streq(sc, "0")) {
|
||||||
|
- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file(fs, "1", 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
@@ -784,7 +784,7 @@ int cg_uninstall_release_agent(const char *controller) {
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file(fs, "0", 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
@@ -794,7 +794,7 @@ int cg_uninstall_release_agent(const char *controller) {
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file(fs, "", 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
@@ -1650,7 +1650,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ return write_string_file(p, value, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
|
||||||
|
diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
|
||||||
|
index da7e836f143e..2138f20bcc03 100644
|
||||||
|
--- a/src/basic/procfs-util.c
|
||||||
|
+++ b/src/basic/procfs-util.c
|
||||||
|
@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
|
||||||
|
* decrease it, as threads-max is the much more relevant sysctl. */
|
||||||
|
if (limit > pid_max-1) {
|
||||||
|
sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
|
||||||
|
- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(buffer, "%" PRIu64, limit);
|
||||||
|
- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
|
||||||
|
if (r < 0) {
|
||||||
|
uint64_t threads_max;
|
||||||
|
|
||||||
|
diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
|
||||||
|
index da9a2139d31a..5e91f5b8f5d9 100644
|
||||||
|
--- a/src/basic/smack-util.c
|
||||||
|
+++ b/src/basic/smack-util.c
|
||||||
|
@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
p = procfs_file_alloca(pid, "attr/current");
|
||||||
|
- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file(p, label, 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
diff --git a/src/basic/util.c b/src/basic/util.c
|
||||||
|
index 2b3b3918a32f..aff8d0fcd473 100644
|
||||||
|
--- a/src/basic/util.c
|
||||||
|
+++ b/src/basic/util.c
|
||||||
|
@@ -267,7 +267,7 @@ void disable_coredumps(void) {
|
||||||
|
if (detect_container() > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
|
||||||
|
if (r < 0)
|
||||||
|
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
|
||||||
|
}
|
||||||
|
diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
|
||||||
|
index 7ff844c78c3a..5c5721d7c2f7 100644
|
||||||
|
--- a/src/binfmt/binfmt.c
|
||||||
|
+++ b/src/binfmt/binfmt.c
|
||||||
|
@@ -47,7 +47,7 @@ static int delete_rule(const char *rule) {
|
||||||
|
if (!fn)
|
||||||
|
return log_oom();
|
||||||
|
|
||||||
|
- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ return write_string_file(fn, "-1", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int apply_rule(const char *rule) {
|
||||||
|
@@ -55,7 +55,7 @@ static int apply_rule(const char *rule) {
|
||||||
|
|
||||||
|
(void) delete_rule(rule);
|
||||||
|
|
||||||
|
- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to add binary format: %m");
|
||||||
|
|
||||||
|
@@ -212,7 +212,7 @@ static int run(int argc, char *argv[]) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flush out all rules */
|
||||||
|
- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
|
||||||
|
|
||||||
|
STRV_FOREACH(f, files) {
|
||||||
|
k = apply_file(*f, true);
|
||||||
|
diff --git a/src/core/main.c b/src/core/main.c
|
||||||
|
index 3c6b66e89c8e..c39ebe56a5b3 100644
|
||||||
|
--- a/src/core/main.c
|
||||||
|
+++ b/src/core/main.c
|
||||||
|
@@ -1312,7 +1312,7 @@ static int bump_unix_max_dgram_qlen(void) {
|
||||||
|
if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
|
||||||
|
+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
|
||||||
|
if (r < 0)
|
||||||
|
return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
|
||||||
|
"Failed to bump AF_UNIX datagram queue length, ignoring: %m");
|
||||||
|
@@ -1536,7 +1536,7 @@ static void initialize_core_pattern(bool skip_setup) {
|
||||||
|
if (getpid_cached() != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
|
||||||
|
if (r < 0)
|
||||||
|
log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern);
|
||||||
|
}
|
||||||
|
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
|
||||||
|
index 4427397f2715..8aeb5c829513 100644
|
||||||
|
--- a/src/core/smack-setup.c
|
||||||
|
+++ b/src/core/smack-setup.c
|
||||||
|
@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) {
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SMACK_RUN_LABEL
|
||||||
|
- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
|
||||||
|
if (r < 0)
|
||||||
|
log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
|
||||||
|
- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
|
||||||
|
if (r < 0)
|
||||||
|
log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
|
||||||
|
r = write_string_file("/sys/fs/smackfs/netlabel",
|
||||||
|
- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
|
||||||
|
if (r < 0)
|
||||||
|
log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
|
||||||
|
- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
|
||||||
|
if (r < 0)
|
||||||
|
log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
|
||||||
|
#endif
|
||||||
|
diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
|
||||||
|
index 17e7cd1a009b..87a766771663 100644
|
||||||
|
--- a/src/hibernate-resume/hibernate-resume.c
|
||||||
|
+++ b/src/hibernate-resume/hibernate-resume.c
|
||||||
|
@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/sys/power/resume", major_minor, 0);
|
||||||
|
if (r < 0) {
|
||||||
|
log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
|
||||||
|
index 1f2451f8e1b4..3f676ec2841a 100644
|
||||||
|
--- a/src/libsystemd/sd-device/sd-device.c
|
||||||
|
+++ b/src/libsystemd/sd-device/sd-device.c
|
||||||
|
@@ -1849,7 +1849,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
|
||||||
|
if (!value)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
|
||||||
|
+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
|
||||||
|
if (r < 0) {
|
||||||
|
if (r == -ELOOP)
|
||||||
|
return -EINVAL;
|
||||||
|
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
|
||||||
|
index 52a7ea3c77e9..9703de0dabee 100644
|
||||||
|
--- a/src/login/logind-dbus.c
|
||||||
|
+++ b/src/login/logind-dbus.c
|
||||||
|
@@ -1339,7 +1339,7 @@ static int trigger_device(Manager *m, sd_device *d) {
|
||||||
|
if (!t)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ (void) write_string_file(t, "change", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
|
||||||
|
index f5048d9473cb..b6383ab5c97e 100644
|
||||||
|
--- a/src/nspawn/nspawn-cgroup.c
|
||||||
|
+++ b/src/nspawn/nspawn-cgroup.c
|
||||||
|
@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
|
||||||
|
fn = strjoina(tree, cgroup, "/cgroup.procs");
|
||||||
|
|
||||||
|
sprintf(pid_string, PID_FMT, pid);
|
||||||
|
- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
|
||||||
|
+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
|
||||||
|
if (r < 0) {
|
||||||
|
log_error_errno(r, "Failed to move process: %m");
|
||||||
|
goto finish;
|
||||||
|
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
||||||
|
index 734dee1130e0..71add9a055d2 100644
|
||||||
|
--- a/src/nspawn/nspawn.c
|
||||||
|
+++ b/src/nspawn/nspawn.c
|
||||||
|
@@ -2440,7 +2440,7 @@ static int reset_audit_loginuid(void) {
|
||||||
|
if (streq(p, "4294967295"))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
|
||||||
|
if (r < 0) {
|
||||||
|
log_error_errno(r,
|
||||||
|
"Failed to reset audit login UID. This probably means that your kernel is too\n"
|
||||||
|
@@ -3665,13 +3665,13 @@ static int setup_uid_map(pid_t pid) {
|
||||||
|
|
||||||
|
xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
|
||||||
|
xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range);
|
||||||
|
- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file(uid_map, line, 0);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to write UID map: %m");
|
||||||
|
|
||||||
|
/* We always assign the same UID and GID ranges */
|
||||||
|
xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
|
||||||
|
- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file(uid_map, line, 0);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to write GID map: %m");
|
||||||
|
|
||||||
|
diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
|
||||||
|
index e8398cbde5ba..ba682ec0c9e7 100644
|
||||||
|
--- a/src/shared/cgroup-setup.c
|
||||||
|
+++ b/src/shared/cgroup-setup.c
|
||||||
|
@@ -267,7 +267,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
|
||||||
|
|
||||||
|
xsprintf(c, PID_FMT "\n", pid);
|
||||||
|
|
||||||
|
- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file(fs, c, 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
@@ -817,7 +817,7 @@ int cg_enable_everywhere(
|
||||||
|
return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
|
||||||
|
}
|
||||||
|
|
||||||
|
- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_stream(f, s, 0);
|
||||||
|
if (r < 0) {
|
||||||
|
log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
|
||||||
|
FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
|
||||||
|
diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c
|
||||||
|
index 8543dbd2d05f..76162599817e 100644
|
||||||
|
--- a/src/shared/sysctl-util.c
|
||||||
|
+++ b/src/shared/sysctl-util.c
|
||||||
|
@@ -93,7 +93,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c
|
||||||
|
|
||||||
|
log_debug("Setting '%s' to '%s'", p, value);
|
||||||
|
|
||||||
|
- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int sysctl_read(const char *property, char **content) {
|
||||||
|
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
|
||||||
|
index fbfddc0262fc..7cc2902154e9 100644
|
||||||
|
--- a/src/sleep/sleep.c
|
||||||
|
+++ b/src/sleep/sleep.c
|
||||||
|
@@ -47,7 +47,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
|
||||||
|
assert(hibernate_location->swap);
|
||||||
|
|
||||||
|
xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
|
||||||
|
- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/sys/power/resume", resume_str, 0);
|
||||||
|
if (r < 0)
|
||||||
|
return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
|
||||||
|
hibernate_location->swap->device, resume_str);
|
||||||
|
@@ -74,7 +74,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
|
||||||
|
}
|
||||||
|
|
||||||
|
xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
|
||||||
|
- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
|
||||||
|
if (r < 0)
|
||||||
|
return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
|
||||||
|
hibernate_location->swap->device, offset_str);
|
||||||
|
@@ -91,7 +91,7 @@ static int write_mode(char **modes) {
|
||||||
|
STRV_FOREACH(mode, modes) {
|
||||||
|
int k;
|
||||||
|
|
||||||
|
- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ k = write_string_file("/sys/power/disk", *mode, 0);
|
||||||
|
if (k >= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
@@ -110,7 +110,7 @@ static int write_state(FILE **f, char **states) {
|
||||||
|
STRV_FOREACH(state, states) {
|
||||||
|
int k;
|
||||||
|
|
||||||
|
- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ k = write_string_stream(*f, *state, 0);
|
||||||
|
if (k >= 0)
|
||||||
|
return 0;
|
||||||
|
log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
|
||||||
|
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
|
||||||
|
index 60c68b5029cf..fdca03d3d42c 100644
|
||||||
|
--- a/src/udev/udevadm-trigger.c
|
||||||
|
+++ b/src/udev/udevadm-trigger.c
|
||||||
|
@@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set *settle_se
|
||||||
|
if (!filename)
|
||||||
|
return log_oom();
|
||||||
|
|
||||||
|
- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file(filename, action, 0);
|
||||||
|
if (r < 0) {
|
||||||
|
bool ignore = IN_SET(r, -ENOENT, -EACCES, -ENODEV, -EROFS);
|
||||||
|
|
||||||
|
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
|
||||||
|
index ca65474f2763..38780681431a 100644
|
||||||
|
--- a/src/udev/udevd.c
|
||||||
|
+++ b/src/udev/udevd.c
|
||||||
|
@@ -1089,7 +1089,7 @@ static int synthesize_change_one(sd_device *dev, const char *syspath) {
|
||||||
|
|
||||||
|
filename = strjoina(syspath, "/uevent");
|
||||||
|
log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath);
|
||||||
|
- r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file(filename, "change", 0);
|
||||||
|
if (r < 0)
|
||||||
|
return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename);
|
||||||
|
return 0;
|
||||||
|
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
|
||||||
|
index 9d706085fb47..30dcfa86f4d0 100644
|
||||||
|
--- a/src/vconsole/vconsole-setup.c
|
||||||
|
+++ b/src/vconsole/vconsole-setup.c
|
||||||
|
@@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
|
||||||
|
static int toggle_utf8_sysfs(bool utf8) {
|
||||||
|
int r;
|
||||||
|
|
||||||
|
- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
|
||||||
|
if (r < 0)
|
||||||
|
return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
|
||||||
|
|
|
@ -0,0 +1,161 @@
|
||||||
|
From 3eb12a6ba0bce149717eaabeb1505d379b3d705a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 13:41:41 +0800
|
||||||
|
Subject: [PATCH] don't use glibc-specific qsort_r
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
[Rebased for v241]
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
[Rebased for v242]
|
||||||
|
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/sort-util.h | 14 ------------
|
||||||
|
src/libsystemd/sd-hwdb/hwdb-util.c | 19 +++++++++++-----
|
||||||
|
src/shared/format-table.c | 36 ++++++++++++++++++++----------
|
||||||
|
3 files changed, 38 insertions(+), 31 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
|
||||||
|
index e029f8646eb0..27d68b341cf3 100644
|
||||||
|
--- a/src/basic/sort-util.h
|
||||||
|
+++ b/src/basic/sort-util.h
|
||||||
|
@@ -54,17 +54,3 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, __compar_fn
|
||||||
|
int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \
|
||||||
|
qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \
|
||||||
|
})
|
||||||
|
-
|
||||||
|
-static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) {
|
||||||
|
- if (nmemb <= 1)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- assert(base);
|
||||||
|
- qsort_r(base, nmemb, size, compar, userdata);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-#define typesafe_qsort_r(p, n, func, userdata) \
|
||||||
|
- ({ \
|
||||||
|
- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \
|
||||||
|
- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \
|
||||||
|
- })
|
||||||
|
diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c
|
||||||
|
index d790e8fd0b19..42e0fd7c9b3c 100644
|
||||||
|
--- a/src/libsystemd/sd-hwdb/hwdb-util.c
|
||||||
|
+++ b/src/libsystemd/sd-hwdb/hwdb-util.c
|
||||||
|
@@ -128,9 +128,13 @@ static void trie_free(struct trie *trie) {
|
||||||
|
|
||||||
|
DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free);
|
||||||
|
|
||||||
|
-static int trie_values_cmp(const struct trie_value_entry *a, const struct trie_value_entry *b, struct trie *trie) {
|
||||||
|
- return strcmp(trie->strings->buf + a->key_off,
|
||||||
|
- trie->strings->buf + b->key_off);
|
||||||
|
+static struct trie *trie_node_add_value_trie;
|
||||||
|
+static int trie_values_cmp(const void *v1, const void *v2) {
|
||||||
|
+ const struct trie_value_entry *a = v1;
|
||||||
|
+ const struct trie_value_entry *b = v2;
|
||||||
|
+
|
||||||
|
+ return strcmp(trie_node_add_value_trie->strings->buf + a->key_off,
|
||||||
|
+ trie_node_add_value_trie->strings->buf + b->key_off);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int trie_node_add_value(struct trie *trie, struct trie_node *node,
|
||||||
|
@@ -158,7 +162,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
|
||||||
|
.value_off = v,
|
||||||
|
};
|
||||||
|
|
||||||
|
- val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie);
|
||||||
|
+ trie_node_add_value_trie = trie;
|
||||||
|
+ val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp);
|
||||||
|
+ trie_node_add_value_trie = NULL;
|
||||||
|
+
|
||||||
|
if (val) {
|
||||||
|
/* At this point we have 2 identical properties on the same match-string.
|
||||||
|
* Since we process files in order, we just replace the previous value. */
|
||||||
|
@@ -184,7 +191,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
|
||||||
|
.line_number = line_number,
|
||||||
|
};
|
||||||
|
node->values_count++;
|
||||||
|
- typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie);
|
||||||
|
+ trie_node_add_value_trie = trie;
|
||||||
|
+ qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp);
|
||||||
|
+ trie_node_add_value_trie = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/shared/format-table.c b/src/shared/format-table.c
|
||||||
|
index 425013046491..33c1c5a12d43 100644
|
||||||
|
--- a/src/shared/format-table.c
|
||||||
|
+++ b/src/shared/format-table.c
|
||||||
|
@@ -1164,31 +1164,33 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t
|
||||||
|
return CMP(index_a, index_b);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int table_data_compare(const size_t *a, const size_t *b, Table *t) {
|
||||||
|
+static Table *user_table;
|
||||||
|
+static int table_data_compare(const void *x, const void *y) {
|
||||||
|
+ const size_t *a = x, *b=y;
|
||||||
|
size_t i;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
- assert(t);
|
||||||
|
- assert(t->sort_map);
|
||||||
|
+ assert(user_table);
|
||||||
|
+ assert(user_table->sort_map);
|
||||||
|
|
||||||
|
/* Make sure the header stays at the beginning */
|
||||||
|
- if (*a < t->n_columns && *b < t->n_columns)
|
||||||
|
+ if (*a < user_table->n_columns && *b < user_table->n_columns)
|
||||||
|
return 0;
|
||||||
|
- if (*a < t->n_columns)
|
||||||
|
+ if (*a < user_table->n_columns)
|
||||||
|
return -1;
|
||||||
|
- if (*b < t->n_columns)
|
||||||
|
+ if (*b < user_table->n_columns)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* Order other lines by the sorting map */
|
||||||
|
- for (i = 0; i < t->n_sort_map; i++) {
|
||||||
|
+ for (i = 0; i < user_table->n_sort_map; i++) {
|
||||||
|
TableData *d, *dd;
|
||||||
|
|
||||||
|
- d = t->data[*a + t->sort_map[i]];
|
||||||
|
- dd = t->data[*b + t->sort_map[i]];
|
||||||
|
+ d = user_table->data[*a + user_table->sort_map[i]];
|
||||||
|
+ dd = user_table->data[*b + user_table->sort_map[i]];
|
||||||
|
|
||||||
|
r = cell_data_compare(d, *a, dd, *b);
|
||||||
|
if (r != 0)
|
||||||
|
- return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r;
|
||||||
|
+ return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Order identical lines by the order there were originally added in */
|
||||||
|
@@ -1690,7 +1692,12 @@ int table_print(Table *t, FILE *f) {
|
||||||
|
for (i = 0; i < n_rows; i++)
|
||||||
|
sorted[i] = i * t->n_columns;
|
||||||
|
|
||||||
|
- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
|
||||||
|
+ if (n_rows <= 1)
|
||||||
|
+ return 0;
|
||||||
|
+ assert(sorted);
|
||||||
|
+ user_table = t;
|
||||||
|
+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
|
||||||
|
+ user_table = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t->display_map)
|
||||||
|
@@ -2236,7 +2243,12 @@ int table_to_json(Table *t, JsonVariant **ret) {
|
||||||
|
for (i = 0; i < n_rows; i++)
|
||||||
|
sorted[i] = i * t->n_columns;
|
||||||
|
|
||||||
|
- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
|
||||||
|
+ if (n_rows <= 1)
|
||||||
|
+ return 0;
|
||||||
|
+ assert(sorted);
|
||||||
|
+ user_table = t;
|
||||||
|
+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
|
||||||
|
+ user_table = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (t->display_map)
|
|
@ -0,0 +1,29 @@
|
||||||
|
From 106922335ec502bcb4451c54a89be49f88fa54de Mon Sep 17 00:00:00 2001
|
||||||
|
From: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
Date: Fri, 13 Sep 2019 19:26:27 -0400
|
||||||
|
Subject: [PATCH] Include sys/wait.h
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
src/login/logind-brightness.c:158:85: error: 'WEXITED' undeclared (first use in this function); did you mean 'WIFEXITED'?
|
||||||
|
158 | r = sd_event_add_child(w->manager->event, &w->child_event_source, w->child, WEXITED, on_brightness_writer_exit, w);
|
||||||
|
| ^~~~~~~
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/login/logind-brightness.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/login/logind-brightness.c b/src/login/logind-brightness.c
|
||||||
|
index 3f4b65e1fdf1..5af7e3d5ce3f 100644
|
||||||
|
--- a/src/login/logind-brightness.c
|
||||||
|
+++ b/src/login/logind-brightness.c
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <sys/wait.h>
|
||||||
|
#include "bus-util.h"
|
||||||
|
#include "device-util.h"
|
||||||
|
#include "hash-funcs.h"
|
|
@ -0,0 +1,41 @@
|
||||||
|
From f9078501a1495c9991431d1435d081cd2e830328 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Date: Sat, 5 Sep 2015 06:31:47 +0000
|
||||||
|
Subject: [PATCH] implment systemd-sysv-install for OE
|
||||||
|
|
||||||
|
Use update-rc.d for enabling/disabling and status command
|
||||||
|
to check the status of the sysv service
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [OE-Specific]
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/systemctl/systemd-sysv-install.SKELETON | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON
|
||||||
|
index 8c16cf99913f..9f078a121469 100755
|
||||||
|
--- a/src/systemctl/systemd-sysv-install.SKELETON
|
||||||
|
+++ b/src/systemctl/systemd-sysv-install.SKELETON
|
||||||
|
@@ -32,17 +32,17 @@ case "$1" in
|
||||||
|
enable)
|
||||||
|
# call the command to enable SysV init script $NAME here
|
||||||
|
# (consider optional $ROOT)
|
||||||
|
- echo "IMPLEMENT ME: enabling SysV init.d script $NAME"
|
||||||
|
+ update-rc.d -f $NAME defaults
|
||||||
|
;;
|
||||||
|
disable)
|
||||||
|
# call the command to disable SysV init script $NAME here
|
||||||
|
# (consider optional $ROOT)
|
||||||
|
- echo "IMPLEMENT ME: disabling SysV init.d script $NAME"
|
||||||
|
+ update-rc.d -f $NAME remove
|
||||||
|
;;
|
||||||
|
is-enabled)
|
||||||
|
# exit with 0 if $NAME is enabled, non-zero if it is disabled
|
||||||
|
# (consider optional $ROOT)
|
||||||
|
- echo "IMPLEMENT ME: checking SysV init.d script $NAME"
|
||||||
|
+ /etc/init.d/$NAME status
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage ;;
|
|
@ -0,0 +1,76 @@
|
||||||
|
From 233de872b9b033ec842c2135152d2e006ac44c16 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 13:55:12 +0800
|
||||||
|
Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t
|
||||||
|
|
||||||
|
Make it work with musl where comparison_fn_t and __compare_fn_t
|
||||||
|
is not provided.
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||||
|
[Rebased for v244]
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
[Rebased for v242]
|
||||||
|
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/missing_type.h | 9 +++++++++
|
||||||
|
src/basic/sort-util.h | 1 +
|
||||||
|
src/core/kmod-setup.c | 1 +
|
||||||
|
src/journal/catalog.c | 1 +
|
||||||
|
4 files changed, 12 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
|
||||||
|
index bf8a6caa1b46..c487e65e7bde 100644
|
||||||
|
--- a/src/basic/missing_type.h
|
||||||
|
+++ b/src/basic/missing_type.h
|
||||||
|
@@ -10,3 +10,12 @@
|
||||||
|
#if !HAVE_CHAR16_T
|
||||||
|
#define char16_t uint16_t
|
||||||
|
#endif
|
||||||
|
+
|
||||||
|
+#ifndef __GLIBC__
|
||||||
|
+typedef int (*comparison_fn_t)(const void *, const void *);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef __COMPAR_FN_T
|
||||||
|
+#define __COMPAR_FN_T
|
||||||
|
+typedef int (*__compar_fn_t)(const void *, const void *);
|
||||||
|
+#endif
|
||||||
|
diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
|
||||||
|
index 27d68b341cf3..307ea4ac0e8e 100644
|
||||||
|
--- a/src/basic/sort-util.h
|
||||||
|
+++ b/src/basic/sort-util.h
|
||||||
|
@@ -4,6 +4,7 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "macro.h"
|
||||||
|
+#include "missing_type.h"
|
||||||
|
|
||||||
|
void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
|
||||||
|
__compar_d_fn_t compar, void *arg);
|
||||||
|
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
|
||||||
|
index 128674327362..09ccd613e32c 100644
|
||||||
|
--- a/src/core/kmod-setup.c
|
||||||
|
+++ b/src/core/kmod-setup.c
|
||||||
|
@@ -10,6 +10,7 @@
|
||||||
|
#include "kmod-setup.h"
|
||||||
|
#include "macro.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
+#include "missing_type.h"
|
||||||
|
|
||||||
|
#if HAVE_KMOD
|
||||||
|
#include "module-util.h"
|
||||||
|
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
|
||||||
|
index 70b2c8b46c4e..d574a64586f1 100644
|
||||||
|
--- a/src/journal/catalog.c
|
||||||
|
+++ b/src/journal/catalog.c
|
||||||
|
@@ -28,6 +28,7 @@
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
#include "tmpfile-util.h"
|
||||||
|
+#include "missing_type.h"
|
||||||
|
|
||||||
|
const char * const catalog_file_dirs[] = {
|
||||||
|
"/usr/local/lib/systemd/catalog/",
|
|
@ -0,0 +1,31 @@
|
||||||
|
From 082d2eb2a65525890a913723764e67a36ee75384 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
Date: Fri, 13 Sep 2019 19:26:27 -0400
|
||||||
|
Subject: [PATCH] Include signal.h
|
||||||
|
|
||||||
|
Fixes several signal set related errors:
|
||||||
|
src/basic/copy.c:92:19: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration]
|
||||||
|
src/basic/copy.c:93:19: error: implicit declaration of function 'sigaddset' [-Werror=implicit-function-declaration]
|
||||||
|
src/basic/copy.c:93:34: error: 'SIGINT' undeclared (first use in this function)
|
||||||
|
src/basic/copy.c:95:13: error: implicit declaration of function 'sigtimedwait' [-Werror=implicit-function-declaration]
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/copy.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/basic/copy.c b/src/basic/copy.c
|
||||||
|
index 9028868f696d..5168586fa522 100644
|
||||||
|
--- a/src/basic/copy.c
|
||||||
|
+++ b/src/basic/copy.c
|
||||||
|
@@ -8,6 +8,7 @@
|
||||||
|
#include <sys/sendfile.h>
|
||||||
|
#include <sys/xattr.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
+#include <signal.h>
|
||||||
|
|
||||||
|
#include "alloc-util.h"
|
||||||
|
#include "btrfs-util.h"
|
|
@ -0,0 +1,433 @@
|
||||||
|
From 8af168cefca01f8f2da336f1c82620c284dc74f2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 14:04:21 +0800
|
||||||
|
Subject: [PATCH] add fallback parse_printf_format implementation
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
[rebased for systemd 243]
|
||||||
|
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
meson.build | 1 +
|
||||||
|
src/basic/meson.build | 5 +
|
||||||
|
src/basic/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++
|
||||||
|
src/basic/parse-printf-format.h | 57 +++++++
|
||||||
|
src/basic/stdio-util.h | 2 +-
|
||||||
|
src/journal/journal-send.c | 2 +-
|
||||||
|
6 files changed, 338 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 src/basic/parse-printf-format.c
|
||||||
|
create mode 100644 src/basic/parse-printf-format.h
|
||||||
|
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index fc216d22da24..a25996803d64 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -640,6 +640,7 @@ endif
|
||||||
|
foreach header : ['crypt.h',
|
||||||
|
'linux/memfd.h',
|
||||||
|
'linux/vm_sockets.h',
|
||||||
|
+ 'printf.h',
|
||||||
|
'sys/auxv.h',
|
||||||
|
'valgrind/memcheck.h',
|
||||||
|
'valgrind/valgrind.h',
|
||||||
|
diff --git a/src/basic/meson.build b/src/basic/meson.build
|
||||||
|
index ccb22e159505..25c77ea6bc0e 100644
|
||||||
|
--- a/src/basic/meson.build
|
||||||
|
+++ b/src/basic/meson.build
|
||||||
|
@@ -313,6 +313,11 @@ foreach item : [['af', af_list_txt, 'af', ''],
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
basic_sources += generated_gperf_headers
|
||||||
|
+
|
||||||
|
+if conf.get('HAVE_PRINTF_H') != 1
|
||||||
|
+ basic_sources += [files('parse-printf-format.c')]
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
basic_gcrypt_sources = files(
|
||||||
|
'gcrypt-util.c',
|
||||||
|
'gcrypt-util.h')
|
||||||
|
diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..49437e544540
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/basic/parse-printf-format.c
|
||||||
|
@@ -0,0 +1,273 @@
|
||||||
|
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||||
|
+
|
||||||
|
+/***
|
||||||
|
+ This file is part of systemd.
|
||||||
|
+
|
||||||
|
+ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
|
||||||
|
+
|
||||||
|
+ With parts from the musl C library
|
||||||
|
+ Copyright 2005-2014 Rich Felker, et al.
|
||||||
|
+
|
||||||
|
+ systemd is free software; you can redistribute it and/or modify it
|
||||||
|
+ under the terms of the GNU Lesser General Public License as published by
|
||||||
|
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
+ (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ systemd is distributed in the hope that it will be useful, but
|
||||||
|
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public License
|
||||||
|
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+***/
|
||||||
|
+
|
||||||
|
+#include <stddef.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+
|
||||||
|
+#include "parse-printf-format.h"
|
||||||
|
+
|
||||||
|
+static const char *consume_nonarg(const char *fmt)
|
||||||
|
+{
|
||||||
|
+ do {
|
||||||
|
+ if (*fmt == '\0')
|
||||||
|
+ return fmt;
|
||||||
|
+ } while (*fmt++ != '%');
|
||||||
|
+ return fmt;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const char *consume_num(const char *fmt)
|
||||||
|
+{
|
||||||
|
+ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
|
||||||
|
+ /* do nothing */;
|
||||||
|
+ return fmt;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const char *consume_argn(const char *fmt, size_t *arg)
|
||||||
|
+{
|
||||||
|
+ const char *p = fmt;
|
||||||
|
+ size_t val = 0;
|
||||||
|
+
|
||||||
|
+ if (*p < '1' || *p > '9')
|
||||||
|
+ return fmt;
|
||||||
|
+ do {
|
||||||
|
+ val = 10*val + (*p++ - '0');
|
||||||
|
+ } while (*p >= '0' && *p <= '9');
|
||||||
|
+
|
||||||
|
+ if (*p != '$')
|
||||||
|
+ return fmt;
|
||||||
|
+ *arg = val;
|
||||||
|
+ return p+1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const char *consume_flags(const char *fmt)
|
||||||
|
+{
|
||||||
|
+ while (1) {
|
||||||
|
+ switch (*fmt) {
|
||||||
|
+ case '#':
|
||||||
|
+ case '0':
|
||||||
|
+ case '-':
|
||||||
|
+ case ' ':
|
||||||
|
+ case '+':
|
||||||
|
+ case '\'':
|
||||||
|
+ case 'I':
|
||||||
|
+ fmt++;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ return fmt;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+enum state {
|
||||||
|
+ BARE,
|
||||||
|
+ LPRE,
|
||||||
|
+ LLPRE,
|
||||||
|
+ HPRE,
|
||||||
|
+ HHPRE,
|
||||||
|
+ BIGLPRE,
|
||||||
|
+ ZTPRE,
|
||||||
|
+ JPRE,
|
||||||
|
+ STOP
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+enum type {
|
||||||
|
+ NONE,
|
||||||
|
+ PTR,
|
||||||
|
+ INT,
|
||||||
|
+ UINT,
|
||||||
|
+ ULLONG,
|
||||||
|
+ LONG,
|
||||||
|
+ ULONG,
|
||||||
|
+ SHORT,
|
||||||
|
+ USHORT,
|
||||||
|
+ CHAR,
|
||||||
|
+ UCHAR,
|
||||||
|
+ LLONG,
|
||||||
|
+ SIZET,
|
||||||
|
+ IMAX,
|
||||||
|
+ UMAX,
|
||||||
|
+ PDIFF,
|
||||||
|
+ UIPTR,
|
||||||
|
+ DBL,
|
||||||
|
+ LDBL,
|
||||||
|
+ MAXTYPE
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const short pa_types[MAXTYPE] = {
|
||||||
|
+ [NONE] = PA_INT,
|
||||||
|
+ [PTR] = PA_POINTER,
|
||||||
|
+ [INT] = PA_INT,
|
||||||
|
+ [UINT] = PA_INT,
|
||||||
|
+ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
|
||||||
|
+ [LONG] = PA_INT | PA_FLAG_LONG,
|
||||||
|
+ [ULONG] = PA_INT | PA_FLAG_LONG,
|
||||||
|
+ [SHORT] = PA_INT | PA_FLAG_SHORT,
|
||||||
|
+ [USHORT] = PA_INT | PA_FLAG_SHORT,
|
||||||
|
+ [CHAR] = PA_CHAR,
|
||||||
|
+ [UCHAR] = PA_CHAR,
|
||||||
|
+ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
|
||||||
|
+ [SIZET] = PA_INT | PA_FLAG_LONG,
|
||||||
|
+ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
|
||||||
|
+ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
|
||||||
|
+ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
|
||||||
|
+ [UIPTR] = PA_INT | PA_FLAG_LONG,
|
||||||
|
+ [DBL] = PA_DOUBLE,
|
||||||
|
+ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define S(x) [(x)-'A']
|
||||||
|
+#define E(x) (STOP + (x))
|
||||||
|
+
|
||||||
|
+static const unsigned char states[]['z'-'A'+1] = {
|
||||||
|
+ { /* 0: bare types */
|
||||||
|
+ S('d') = E(INT), S('i') = E(INT),
|
||||||
|
+ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
|
||||||
|
+ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
|
||||||
|
+ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
|
||||||
|
+ S('c') = E(CHAR),S('C') = E(INT),
|
||||||
|
+ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
|
||||||
|
+ S('m') = E(NONE),
|
||||||
|
+ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
|
||||||
|
+ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
|
||||||
|
+ }, { /* 1: l-prefixed */
|
||||||
|
+ S('d') = E(LONG), S('i') = E(LONG),
|
||||||
|
+ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
|
||||||
|
+ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
|
||||||
|
+ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
|
||||||
|
+ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
|
||||||
|
+ S('l') = LLPRE
|
||||||
|
+ }, { /* 2: ll-prefixed */
|
||||||
|
+ S('d') = E(LLONG), S('i') = E(LLONG),
|
||||||
|
+ S('o') = E(ULLONG),S('u') = E(ULLONG),
|
||||||
|
+ S('x') = E(ULLONG),S('X') = E(ULLONG),
|
||||||
|
+ S('n') = E(PTR)
|
||||||
|
+ }, { /* 3: h-prefixed */
|
||||||
|
+ S('d') = E(SHORT), S('i') = E(SHORT),
|
||||||
|
+ S('o') = E(USHORT),S('u') = E(USHORT),
|
||||||
|
+ S('x') = E(USHORT),S('X') = E(USHORT),
|
||||||
|
+ S('n') = E(PTR),
|
||||||
|
+ S('h') = HHPRE
|
||||||
|
+ }, { /* 4: hh-prefixed */
|
||||||
|
+ S('d') = E(CHAR), S('i') = E(CHAR),
|
||||||
|
+ S('o') = E(UCHAR),S('u') = E(UCHAR),
|
||||||
|
+ S('x') = E(UCHAR),S('X') = E(UCHAR),
|
||||||
|
+ S('n') = E(PTR)
|
||||||
|
+ }, { /* 5: L-prefixed */
|
||||||
|
+ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
|
||||||
|
+ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
|
||||||
|
+ S('n') = E(PTR)
|
||||||
|
+ }, { /* 6: z- or t-prefixed (assumed to be same size) */
|
||||||
|
+ S('d') = E(PDIFF),S('i') = E(PDIFF),
|
||||||
|
+ S('o') = E(SIZET),S('u') = E(SIZET),
|
||||||
|
+ S('x') = E(SIZET),S('X') = E(SIZET),
|
||||||
|
+ S('n') = E(PTR)
|
||||||
|
+ }, { /* 7: j-prefixed */
|
||||||
|
+ S('d') = E(IMAX), S('i') = E(IMAX),
|
||||||
|
+ S('o') = E(UMAX), S('u') = E(UMAX),
|
||||||
|
+ S('x') = E(UMAX), S('X') = E(UMAX),
|
||||||
|
+ S('n') = E(PTR)
|
||||||
|
+ }
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+size_t parse_printf_format(const char *fmt, size_t n, int *types)
|
||||||
|
+{
|
||||||
|
+ size_t i = 0;
|
||||||
|
+ size_t last = 0;
|
||||||
|
+
|
||||||
|
+ memset(types, 0, n);
|
||||||
|
+
|
||||||
|
+ while (1) {
|
||||||
|
+ size_t arg;
|
||||||
|
+ unsigned int state;
|
||||||
|
+
|
||||||
|
+ fmt = consume_nonarg(fmt);
|
||||||
|
+ if (*fmt == '\0')
|
||||||
|
+ break;
|
||||||
|
+ if (*fmt == '%') {
|
||||||
|
+ fmt++;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ arg = 0;
|
||||||
|
+ fmt = consume_argn(fmt, &arg);
|
||||||
|
+ /* flags */
|
||||||
|
+ fmt = consume_flags(fmt);
|
||||||
|
+ /* width */
|
||||||
|
+ if (*fmt == '*') {
|
||||||
|
+ size_t warg = 0;
|
||||||
|
+ fmt = consume_argn(fmt+1, &warg);
|
||||||
|
+ if (warg == 0)
|
||||||
|
+ warg = ++i;
|
||||||
|
+ if (warg > last)
|
||||||
|
+ last = warg;
|
||||||
|
+ if (warg <= n && types[warg-1] == NONE)
|
||||||
|
+ types[warg-1] = INT;
|
||||||
|
+ } else
|
||||||
|
+ fmt = consume_num(fmt);
|
||||||
|
+ /* precision */
|
||||||
|
+ if (*fmt == '.') {
|
||||||
|
+ fmt++;
|
||||||
|
+ if (*fmt == '*') {
|
||||||
|
+ size_t parg = 0;
|
||||||
|
+ fmt = consume_argn(fmt+1, &parg);
|
||||||
|
+ if (parg == 0)
|
||||||
|
+ parg = ++i;
|
||||||
|
+ if (parg > last)
|
||||||
|
+ last = parg;
|
||||||
|
+ if (parg <= n && types[parg-1] == NONE)
|
||||||
|
+ types[parg-1] = INT;
|
||||||
|
+ } else {
|
||||||
|
+ if (*fmt == '-')
|
||||||
|
+ fmt++;
|
||||||
|
+ fmt = consume_num(fmt);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ /* length modifier and conversion specifier */
|
||||||
|
+ state = BARE;
|
||||||
|
+ do {
|
||||||
|
+ unsigned char c = *fmt++;
|
||||||
|
+
|
||||||
|
+ if (c < 'A' || c > 'z')
|
||||||
|
+ continue;
|
||||||
|
+ state = states[state]S(c);
|
||||||
|
+ if (state == 0)
|
||||||
|
+ continue;
|
||||||
|
+ } while (state < STOP);
|
||||||
|
+
|
||||||
|
+ if (state == E(NONE))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ if (arg == 0)
|
||||||
|
+ arg = ++i;
|
||||||
|
+ if (arg > last)
|
||||||
|
+ last = arg;
|
||||||
|
+ if (arg <= n)
|
||||||
|
+ types[arg-1] = state - STOP;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (last > n)
|
||||||
|
+ last = n;
|
||||||
|
+ for (i = 0; i < last; i++)
|
||||||
|
+ types[i] = pa_types[types[i]];
|
||||||
|
+
|
||||||
|
+ return last;
|
||||||
|
+}
|
||||||
|
diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..47be7522d7fa
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/basic/parse-printf-format.h
|
||||||
|
@@ -0,0 +1,57 @@
|
||||||
|
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||||
|
+
|
||||||
|
+/***
|
||||||
|
+ This file is part of systemd.
|
||||||
|
+
|
||||||
|
+ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
|
||||||
|
+
|
||||||
|
+ With parts from the GNU C Library
|
||||||
|
+ Copyright 1991-2014 Free Software Foundation, Inc.
|
||||||
|
+
|
||||||
|
+ systemd is free software; you can redistribute it and/or modify it
|
||||||
|
+ under the terms of the GNU Lesser General Public License as published by
|
||||||
|
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
+ (at your option) any later version.
|
||||||
|
+
|
||||||
|
+ systemd is distributed in the hope that it will be useful, but
|
||||||
|
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ Lesser General Public License for more details.
|
||||||
|
+
|
||||||
|
+ You should have received a copy of the GNU Lesser General Public License
|
||||||
|
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+***/
|
||||||
|
+
|
||||||
|
+#pragma once
|
||||||
|
+
|
||||||
|
+#include "config.h"
|
||||||
|
+
|
||||||
|
+#if HAVE_PRINTF_H
|
||||||
|
+#include <printf.h>
|
||||||
|
+#else
|
||||||
|
+
|
||||||
|
+#include <stddef.h>
|
||||||
|
+
|
||||||
|
+enum { /* C type: */
|
||||||
|
+ PA_INT, /* int */
|
||||||
|
+ PA_CHAR, /* int, cast to char */
|
||||||
|
+ PA_WCHAR, /* wide char */
|
||||||
|
+ PA_STRING, /* const char *, a '\0'-terminated string */
|
||||||
|
+ PA_WSTRING, /* const wchar_t *, wide character string */
|
||||||
|
+ PA_POINTER, /* void * */
|
||||||
|
+ PA_FLOAT, /* float */
|
||||||
|
+ PA_DOUBLE, /* double */
|
||||||
|
+ PA_LAST
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* Flag bits that can be set in a type returned by `parse_printf_format'. */
|
||||||
|
+#define PA_FLAG_MASK 0xff00
|
||||||
|
+#define PA_FLAG_LONG_LONG (1 << 8)
|
||||||
|
+#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
|
||||||
|
+#define PA_FLAG_LONG (1 << 9)
|
||||||
|
+#define PA_FLAG_SHORT (1 << 10)
|
||||||
|
+#define PA_FLAG_PTR (1 << 11)
|
||||||
|
+
|
||||||
|
+size_t parse_printf_format(const char *fmt, size_t n, int *types);
|
||||||
|
+
|
||||||
|
+#endif /* HAVE_PRINTF_H */
|
||||||
|
diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
|
||||||
|
index c3b9448d4f4f..2937aa13b178 100644
|
||||||
|
--- a/src/basic/stdio-util.h
|
||||||
|
+++ b/src/basic/stdio-util.h
|
||||||
|
@@ -1,13 +1,13 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
-#include <printf.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "macro.h"
|
||||||
|
#include "memory-util.h"
|
||||||
|
+#include "parse-printf-format.h"
|
||||||
|
|
||||||
|
#define snprintf_ok(buf, len, fmt, ...) \
|
||||||
|
((size_t) snprintf(buf, len, fmt, __VA_ARGS__) < (len))
|
||||||
|
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
|
||||||
|
index 912ecef73cce..43ed756bda53 100644
|
||||||
|
--- a/src/journal/journal-send.c
|
||||||
|
+++ b/src/journal/journal-send.c
|
||||||
|
@@ -2,7 +2,6 @@
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
-#include <printf.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/un.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
@@ -20,6 +19,7 @@
|
||||||
|
#include "stdio-util.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "tmpfile-util.h"
|
||||||
|
+#include "parse-printf-format.h"
|
||||||
|
|
||||||
|
#define SNDBUF_SIZE (8*1024*1024)
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
From dbe8b3ee45580defeefcac929b897c5437ffc50b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
Date: Fri, 13 Sep 2019 19:26:27 -0400
|
||||||
|
Subject: [PATCH] Handle __cpu_mask usage
|
||||||
|
|
||||||
|
Fixes errors:
|
||||||
|
|
||||||
|
src/test/test-cpu-set-util.c:18:54: error: '__cpu_mask' undeclared (first use in this function)
|
||||||
|
src/test/test-sizeof.c:73:14: error: '__cpu_mask' undeclared (first use in this function)
|
||||||
|
|
||||||
|
__cpu_mask is an internal type of glibc's cpu_set implementation, not
|
||||||
|
part of the POSIX definition, which is problematic when building with
|
||||||
|
musl, which does not define a matching type. From inspection of musl's
|
||||||
|
sched.h, however, it is clear that the corresponding type would be
|
||||||
|
unsigned long, which does match glibc's actual __CPU_MASK_TYPE. So,
|
||||||
|
add a typedef to cpu-set-util.h defining __cpu_mask appropriately.
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/shared/cpu-set-util.h | 2 ++
|
||||||
|
src/test/test-sizeof.c | 2 +-
|
||||||
|
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h
|
||||||
|
index 27812dfd5923..0ab40731ea93 100644
|
||||||
|
--- a/src/shared/cpu-set-util.h
|
||||||
|
+++ b/src/shared/cpu-set-util.h
|
||||||
|
@@ -6,6 +6,8 @@
|
||||||
|
#include "macro.h"
|
||||||
|
#include "missing_syscall.h"
|
||||||
|
|
||||||
|
+typedef unsigned long __cpu_mask;
|
||||||
|
+
|
||||||
|
/* This wraps the libc interface with a variable to keep the allocated size. */
|
||||||
|
typedef struct CPUSet {
|
||||||
|
cpu_set_t *set;
|
||||||
|
diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
|
||||||
|
index c65062d2562c..8b6eefa9cdae 100644
|
||||||
|
--- a/src/test/test-sizeof.c
|
||||||
|
+++ b/src/test/test-sizeof.c
|
||||||
|
@@ -1,6 +1,5 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
-#include <sched.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
@@ -10,6 +9,7 @@
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
|
#include "time-util.h"
|
||||||
|
+#include "cpu-set-util.h"
|
||||||
|
|
||||||
|
/* Print information about various types. Useful when diagnosing
|
||||||
|
* gcc diagnostics on an unfamiliar architecture. */
|
|
@ -0,0 +1,666 @@
|
||||||
|
From 85dcaad8f38521ec3dc580794072b601900eed84 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 14:18:21 +0800
|
||||||
|
Subject: [PATCH] src/basic/missing.h: check for missing strndupa
|
||||||
|
|
||||||
|
include missing.h for definition of strndupa
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
[Rebased for v242]
|
||||||
|
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||||
|
[rebased for systemd 243]
|
||||||
|
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||||
|
[rebased for systemd 244]
|
||||||
|
|
||||||
|
---
|
||||||
|
meson.build | 1 +
|
||||||
|
src/backlight/backlight.c | 1 +
|
||||||
|
src/basic/cgroup-util.c | 1 +
|
||||||
|
src/basic/env-util.c | 1 +
|
||||||
|
src/basic/log.c | 1 +
|
||||||
|
src/basic/missing_stdlib.h | 12 ++++++++++++
|
||||||
|
src/basic/mkdir.c | 1 +
|
||||||
|
src/basic/parse-util.c | 1 +
|
||||||
|
src/basic/proc-cmdline.c | 1 +
|
||||||
|
src/basic/procfs-util.c | 1 +
|
||||||
|
src/basic/selinux-util.c | 1 +
|
||||||
|
src/basic/time-util.c | 1 +
|
||||||
|
src/boot/bless-boot.c | 1 +
|
||||||
|
src/core/dbus-cgroup.c | 1 +
|
||||||
|
src/core/dbus-execute.c | 1 +
|
||||||
|
src/core/dbus-util.c | 1 +
|
||||||
|
src/core/execute.c | 1 +
|
||||||
|
src/core/kmod-setup.c | 1 +
|
||||||
|
src/core/service.c | 1 +
|
||||||
|
src/coredump/coredump-vacuum.c | 1 +
|
||||||
|
src/journal-remote/journal-remote-main.c | 1 +
|
||||||
|
src/journal/journalctl.c | 1 +
|
||||||
|
src/journal/sd-journal.c | 1 +
|
||||||
|
src/libsystemd/sd-bus/bus-message.c | 1 +
|
||||||
|
src/libsystemd/sd-bus/bus-objects.c | 1 +
|
||||||
|
src/libsystemd/sd-bus/bus-socket.c | 1 +
|
||||||
|
src/libsystemd/sd-bus/sd-bus.c | 1 +
|
||||||
|
src/libsystemd/sd-bus/test-bus-benchmark.c | 1 +
|
||||||
|
src/locale/keymap-util.c | 1 +
|
||||||
|
src/login/pam_systemd.c | 1 +
|
||||||
|
src/network/generator/network-generator.c | 1 +
|
||||||
|
src/nspawn/nspawn-settings.c | 1 +
|
||||||
|
src/nss-mymachines/nss-mymachines.c | 1 +
|
||||||
|
src/portable/portable.c | 1 +
|
||||||
|
src/resolve/resolvectl.c | 1 +
|
||||||
|
src/shared/bus-unit-procs.c | 1 +
|
||||||
|
src/shared/bus-unit-util.c | 1 +
|
||||||
|
src/shared/bus-util.c | 1 +
|
||||||
|
src/shared/dns-domain.c | 1 +
|
||||||
|
src/shared/journal-importer.c | 1 +
|
||||||
|
src/shared/logs-show.c | 1 +
|
||||||
|
src/shared/pager.c | 1 +
|
||||||
|
src/shared/path-lookup.c | 1 +
|
||||||
|
src/shared/uid-range.c | 1 +
|
||||||
|
src/socket-proxy/socket-proxyd.c | 1 +
|
||||||
|
src/test/test-hexdecoct.c | 1 +
|
||||||
|
src/udev/udev-builtin-path_id.c | 1 +
|
||||||
|
src/udev/udev-event.c | 1 +
|
||||||
|
src/udev/udev-rules.c | 1 +
|
||||||
|
49 files changed, 60 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index a25996803d64..72b305b5ab58 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -529,6 +529,7 @@ foreach ident : [
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <sys/wait.h>'''],
|
||||||
|
+ ['strndupa' , '''#include <string.h>'''],
|
||||||
|
]
|
||||||
|
|
||||||
|
have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
|
||||||
|
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
|
||||||
|
index 048441429025..01d74ea0ed4e 100644
|
||||||
|
--- a/src/backlight/backlight.c
|
||||||
|
+++ b/src/backlight/backlight.c
|
||||||
|
@@ -17,6 +17,7 @@
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
#include "util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) {
|
||||||
|
const char *subsystem, *sysname, *value;
|
||||||
|
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
|
||||||
|
index 54fc6ecf8b20..a5141f4cbedd 100644
|
||||||
|
--- a/src/basic/cgroup-util.c
|
||||||
|
+++ b/src/basic/cgroup-util.c
|
||||||
|
@@ -37,6 +37,7 @@
|
||||||
|
#include "strv.h"
|
||||||
|
#include "unit-name.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
|
||||||
|
_cleanup_free_ char *fs = NULL;
|
||||||
|
diff --git a/src/basic/env-util.c b/src/basic/env-util.c
|
||||||
|
index b8dc98915f81..5049b37594bc 100644
|
||||||
|
--- a/src/basic/env-util.c
|
||||||
|
+++ b/src/basic/env-util.c
|
||||||
|
@@ -15,6 +15,7 @@
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define VALID_CHARS_ENV_NAME \
|
||||||
|
DIGITS LETTERS \
|
||||||
|
diff --git a/src/basic/log.c b/src/basic/log.c
|
||||||
|
index 17557e1844b2..6cec4d324aab 100644
|
||||||
|
--- a/src/basic/log.c
|
||||||
|
+++ b/src/basic/log.c
|
||||||
|
@@ -34,6 +34,7 @@
|
||||||
|
#include "terminal-util.h"
|
||||||
|
#include "time-util.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define SNDBUF_SIZE (8*1024*1024)
|
||||||
|
|
||||||
|
diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h
|
||||||
|
index 188a8d44066a..1e16ec287aad 100644
|
||||||
|
--- a/src/basic/missing_stdlib.h
|
||||||
|
+++ b/src/basic/missing_stdlib.h
|
||||||
|
@@ -11,3 +11,15 @@
|
||||||
|
# error "neither secure_getenv nor __secure_getenv are available"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
+
|
||||||
|
+/* string.h */
|
||||||
|
+#if ! HAVE_STRNDUPA
|
||||||
|
+#define strndupa(s, n) \
|
||||||
|
+ ({ \
|
||||||
|
+ const char *__old = (s); \
|
||||||
|
+ size_t __len = strnlen(__old, (n)); \
|
||||||
|
+ char *__new = (char *)alloca(__len + 1); \
|
||||||
|
+ __new[__len] = '\0'; \
|
||||||
|
+ (char *)memcpy(__new, __old, __len); \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c
|
||||||
|
index fa682d4c438e..37902551490a 100644
|
||||||
|
--- a/src/basic/mkdir.c
|
||||||
|
+++ b/src/basic/mkdir.c
|
||||||
|
@@ -13,6 +13,7 @@
|
||||||
|
#include "stat-util.h"
|
||||||
|
#include "stdio-util.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlags flags, mkdir_func_t _mkdir) {
|
||||||
|
struct stat st;
|
||||||
|
diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
|
||||||
|
index e0094b0f370a..00da6518124b 100644
|
||||||
|
--- a/src/basic/parse-util.c
|
||||||
|
+++ b/src/basic/parse-util.c
|
||||||
|
@@ -18,6 +18,7 @@
|
||||||
|
#include "process-util.h"
|
||||||
|
#include "stat-util.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
int parse_boolean(const char *v) {
|
||||||
|
if (!v)
|
||||||
|
diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
|
||||||
|
index 1af58717c686..c1020f4611d4 100644
|
||||||
|
--- a/src/basic/proc-cmdline.c
|
||||||
|
+++ b/src/basic/proc-cmdline.c
|
||||||
|
@@ -15,6 +15,7 @@
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "virt.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
int proc_cmdline(char **ret) {
|
||||||
|
const char *e;
|
||||||
|
diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
|
||||||
|
index 7aaf95bfced2..da7e836f143e 100644
|
||||||
|
--- a/src/basic/procfs-util.c
|
||||||
|
+++ b/src/basic/procfs-util.c
|
||||||
|
@@ -11,6 +11,7 @@
|
||||||
|
#include "procfs-util.h"
|
||||||
|
#include "stdio-util.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
int procfs_tasks_get_limit(uint64_t *ret) {
|
||||||
|
_cleanup_free_ char *value = NULL;
|
||||||
|
diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c
|
||||||
|
index 1095cb426cce..806ef4bd97a9 100644
|
||||||
|
--- a/src/basic/selinux-util.c
|
||||||
|
+++ b/src/basic/selinux-util.c
|
||||||
|
@@ -26,6 +26,7 @@
|
||||||
|
#include "selinux-util.h"
|
||||||
|
#include "stdio-util.h"
|
||||||
|
#include "time-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#if HAVE_SELINUX
|
||||||
|
DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free);
|
||||||
|
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
|
||||||
|
index 105584e2e72f..eb0bed47dac3 100644
|
||||||
|
--- a/src/basic/time-util.c
|
||||||
|
+++ b/src/basic/time-util.c
|
||||||
|
@@ -26,6 +26,7 @@
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
#include "time-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static clockid_t map_clock_id(clockid_t c) {
|
||||||
|
|
||||||
|
diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c
|
||||||
|
index b96e1f927fff..cba979baca3e 100644
|
||||||
|
--- a/src/boot/bless-boot.c
|
||||||
|
+++ b/src/boot/bless-boot.c
|
||||||
|
@@ -18,6 +18,7 @@
|
||||||
|
#include "util.h"
|
||||||
|
#include "verbs.h"
|
||||||
|
#include "virt.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static char **arg_path = NULL;
|
||||||
|
|
||||||
|
diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
|
||||||
|
index 27dc9e43c3e2..b1a83023600b 100644
|
||||||
|
--- a/src/core/dbus-cgroup.c
|
||||||
|
+++ b/src/core/dbus-cgroup.c
|
||||||
|
@@ -15,6 +15,7 @@
|
||||||
|
#include "fileio.h"
|
||||||
|
#include "limits-util.h"
|
||||||
|
#include "path-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve);
|
||||||
|
|
||||||
|
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
|
||||||
|
index d8ba3e5d9241..729e13fda64c 100644
|
||||||
|
--- a/src/core/dbus-execute.c
|
||||||
|
+++ b/src/core/dbus-execute.c
|
||||||
|
@@ -41,6 +41,7 @@
|
||||||
|
#include "unit-printf.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
|
||||||
|
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
|
||||||
|
diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c
|
||||||
|
index 7862beaacb6d..3b1ea53a5f0d 100644
|
||||||
|
--- a/src/core/dbus-util.c
|
||||||
|
+++ b/src/core/dbus-util.c
|
||||||
|
@@ -7,6 +7,7 @@
|
||||||
|
#include "unit-printf.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
#include "unit.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
int bus_property_get_triggered_unit(
|
||||||
|
sd_bus *bus,
|
||||||
|
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||||
|
index 89dbf6fbd2c1..9762dc57443c 100644
|
||||||
|
--- a/src/core/execute.c
|
||||||
|
+++ b/src/core/execute.c
|
||||||
|
@@ -88,6 +88,7 @@
|
||||||
|
#include "unit.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
#include "utmp-wtmp.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC)
|
||||||
|
#define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC)
|
||||||
|
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
|
||||||
|
index 09ccd613e32c..f4e64fa283e9 100644
|
||||||
|
--- a/src/core/kmod-setup.c
|
||||||
|
+++ b/src/core/kmod-setup.c
|
||||||
|
@@ -11,6 +11,7 @@
|
||||||
|
#include "macro.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "missing_type.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#if HAVE_KMOD
|
||||||
|
#include "module-util.h"
|
||||||
|
diff --git a/src/core/service.c b/src/core/service.c
|
||||||
|
index 17f27a4abce3..e5dcc532d0ce 100644
|
||||||
|
--- a/src/core/service.c
|
||||||
|
+++ b/src/core/service.c
|
||||||
|
@@ -41,6 +41,7 @@
|
||||||
|
#include "unit.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
#include "util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
|
||||||
|
[SERVICE_DEAD] = UNIT_INACTIVE,
|
||||||
|
diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c
|
||||||
|
index 35885dfb47c4..bb9f0660a6a0 100644
|
||||||
|
--- a/src/coredump/coredump-vacuum.c
|
||||||
|
+++ b/src/coredump/coredump-vacuum.c
|
||||||
|
@@ -16,6 +16,7 @@
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "time-util.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
|
||||||
|
#define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
|
||||||
|
diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c
|
||||||
|
index 88e42d3a984b..0f08376e5399 100644
|
||||||
|
--- a/src/journal-remote/journal-remote-main.c
|
||||||
|
+++ b/src/journal-remote/journal-remote-main.c
|
||||||
|
@@ -22,6 +22,7 @@
|
||||||
|
#include "stat-util.h"
|
||||||
|
#include "string-table.h"
|
||||||
|
#include "strv.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
|
||||||
|
#define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
|
||||||
|
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
|
||||||
|
index e5feec83bce6..c3aec1e219d7 100644
|
||||||
|
--- a/src/journal/journalctl.c
|
||||||
|
+++ b/src/journal/journalctl.c
|
||||||
|
@@ -69,6 +69,7 @@
|
||||||
|
#include "unit-name.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
#include "varlink.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
|
||||||
|
#define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */
|
||||||
|
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
|
||||||
|
index 3fa98dfda237..e655d77e714a 100644
|
||||||
|
--- a/src/journal/sd-journal.c
|
||||||
|
+++ b/src/journal/sd-journal.c
|
||||||
|
@@ -40,6 +40,7 @@
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
#include "syslog-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define JOURNAL_FILES_MAX 7168
|
||||||
|
|
||||||
|
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
|
||||||
|
index 73127dfe0253..cc8635dea591 100644
|
||||||
|
--- a/src/libsystemd/sd-bus/bus-message.c
|
||||||
|
+++ b/src/libsystemd/sd-bus/bus-message.c
|
||||||
|
@@ -21,6 +21,7 @@
|
||||||
|
#include "strv.h"
|
||||||
|
#include "time-util.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
|
||||||
|
|
||||||
|
diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
|
||||||
|
index 6d140348ec4c..9126b8801bc5 100644
|
||||||
|
--- a/src/libsystemd/sd-bus/bus-objects.c
|
||||||
|
+++ b/src/libsystemd/sd-bus/bus-objects.c
|
||||||
|
@@ -13,6 +13,7 @@
|
||||||
|
#include "set.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static int node_vtable_get_userdata(
|
||||||
|
sd_bus *bus,
|
||||||
|
diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
|
||||||
|
index 18d30d010a20..be2ab703f8ed 100644
|
||||||
|
--- a/src/libsystemd/sd-bus/bus-socket.c
|
||||||
|
+++ b/src/libsystemd/sd-bus/bus-socket.c
|
||||||
|
@@ -28,6 +28,7 @@
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define SNDBUF_SIZE (8*1024*1024)
|
||||||
|
|
||||||
|
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
|
||||||
|
index 7ad03680f48d..b9d2181e4910 100644
|
||||||
|
--- a/src/libsystemd/sd-bus/sd-bus.c
|
||||||
|
+++ b/src/libsystemd/sd-bus/sd-bus.c
|
||||||
|
@@ -41,6 +41,7 @@
|
||||||
|
#include "process-util.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define log_debug_bus_message(m) \
|
||||||
|
do { \
|
||||||
|
diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c
|
||||||
|
index 8de0a859ee94..58044b6ba908 100644
|
||||||
|
--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
|
||||||
|
+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
|
||||||
|
@@ -14,6 +14,7 @@
|
||||||
|
#include "missing_resource.h"
|
||||||
|
#include "time-util.h"
|
||||||
|
#include "util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define MAX_SIZE (2*1024*1024)
|
||||||
|
|
||||||
|
diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
|
||||||
|
index 30669a9359e5..6544b3722099 100644
|
||||||
|
--- a/src/locale/keymap-util.c
|
||||||
|
+++ b/src/locale/keymap-util.c
|
||||||
|
@@ -21,6 +21,7 @@
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
#include "tmpfile-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static bool startswith_comma(const char *s, const char *prefix) {
|
||||||
|
s = startswith(s, prefix);
|
||||||
|
diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
|
||||||
|
index 84bea21ab7be..49720c7f742e 100644
|
||||||
|
--- a/src/login/pam_systemd.c
|
||||||
|
+++ b/src/login/pam_systemd.c
|
||||||
|
@@ -31,6 +31,7 @@
|
||||||
|
#include "locale-util.h"
|
||||||
|
#include "login-util.h"
|
||||||
|
#include "macro.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
#include "pam-util.h"
|
||||||
|
#include "parse-util.h"
|
||||||
|
#include "path-util.h"
|
||||||
|
diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c
|
||||||
|
index bed1e42697c4..e4847c2beea2 100644
|
||||||
|
--- a/src/network/generator/network-generator.c
|
||||||
|
+++ b/src/network/generator/network-generator.c
|
||||||
|
@@ -13,6 +13,7 @@
|
||||||
|
#include "string-table.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
# .network
|
||||||
|
diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c
|
||||||
|
index 5fb5b49bbcc3..785ccc2da307 100644
|
||||||
|
--- a/src/nspawn/nspawn-settings.c
|
||||||
|
+++ b/src/nspawn/nspawn-settings.c
|
||||||
|
@@ -16,6 +16,7 @@
|
||||||
|
#include "strv.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
#include "util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
Settings *settings_new(void) {
|
||||||
|
Settings *s;
|
||||||
|
diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c
|
||||||
|
index 364356da5622..47d4ea44e40f 100644
|
||||||
|
--- a/src/nss-mymachines/nss-mymachines.c
|
||||||
|
+++ b/src/nss-mymachines/nss-mymachines.c
|
||||||
|
@@ -19,6 +19,7 @@
|
||||||
|
#include "signal-util.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
NSS_GETHOSTBYNAME_PROTOTYPES(mymachines);
|
||||||
|
NSS_GETPW_PROTOTYPES(mymachines);
|
||||||
|
diff --git a/src/portable/portable.c b/src/portable/portable.c
|
||||||
|
index e18826ab2685..d9f4b81d8937 100644
|
||||||
|
--- a/src/portable/portable.c
|
||||||
|
+++ b/src/portable/portable.c
|
||||||
|
@@ -31,6 +31,7 @@
|
||||||
|
#include "strv.h"
|
||||||
|
#include "tmpfile-util.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static const char profile_dirs[] = CONF_PATHS_NULSTR("systemd/portable/profile");
|
||||||
|
|
||||||
|
diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c
|
||||||
|
index f20e8c44b8bc..9f6c4e8f49a7 100644
|
||||||
|
--- a/src/resolve/resolvectl.c
|
||||||
|
+++ b/src/resolve/resolvectl.c
|
||||||
|
@@ -33,6 +33,7 @@
|
||||||
|
#include "strv.h"
|
||||||
|
#include "terminal-util.h"
|
||||||
|
#include "verbs.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static int arg_family = AF_UNSPEC;
|
||||||
|
static int arg_ifindex = 0;
|
||||||
|
diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c
|
||||||
|
index b21fe393265f..af2640005c1d 100644
|
||||||
|
--- a/src/shared/bus-unit-procs.c
|
||||||
|
+++ b/src/shared/bus-unit-procs.c
|
||||||
|
@@ -10,6 +10,7 @@
|
||||||
|
#include "sort-util.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "terminal-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
struct CGroupInfo {
|
||||||
|
char *cgroup_path;
|
||||||
|
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
|
||||||
|
index 28d85944a8a7..4743a84a417e 100644
|
||||||
|
--- a/src/shared/bus-unit-util.c
|
||||||
|
+++ b/src/shared/bus-unit-util.c
|
||||||
|
@@ -34,6 +34,7 @@
|
||||||
|
#include "unit-def.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
|
||||||
|
assert(message);
|
||||||
|
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
|
||||||
|
index 8e6a6e2ce2de..0cbf4b1997df 100644
|
||||||
|
--- a/src/shared/bus-util.c
|
||||||
|
+++ b/src/shared/bus-util.c
|
||||||
|
@@ -30,6 +30,7 @@
|
||||||
|
#include "stdio-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
|
||||||
|
sd_event *e = userdata;
|
||||||
|
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
|
||||||
|
index b812665315f6..8e68f7f8fc6c 100644
|
||||||
|
--- a/src/shared/dns-domain.c
|
||||||
|
+++ b/src/shared/dns-domain.c
|
||||||
|
@@ -23,6 +23,7 @@
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) {
|
||||||
|
const char *n;
|
||||||
|
diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c
|
||||||
|
index 7c4fc7021dec..3fbaf5a63969 100644
|
||||||
|
--- a/src/shared/journal-importer.c
|
||||||
|
+++ b/src/shared/journal-importer.c
|
||||||
|
@@ -14,6 +14,7 @@
|
||||||
|
#include "parse-util.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "unaligned.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */
|
||||||
|
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
|
||||||
|
index 2bfd0b60c26b..6a1bb3a0760f 100644
|
||||||
|
--- a/src/shared/logs-show.c
|
||||||
|
+++ b/src/shared/logs-show.c
|
||||||
|
@@ -39,6 +39,7 @@
|
||||||
|
#include "time-util.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
#include "util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
/* up to three lines (each up to 100 characters) or 300 characters, whichever is less */
|
||||||
|
#define PRINT_LINE_THRESHOLD 3
|
||||||
|
diff --git a/src/shared/pager.c b/src/shared/pager.c
|
||||||
|
index 1fe9db179176..67954b5cab93 100644
|
||||||
|
--- a/src/shared/pager.c
|
||||||
|
+++ b/src/shared/pager.c
|
||||||
|
@@ -23,6 +23,7 @@
|
||||||
|
#include "strv.h"
|
||||||
|
#include "terminal-util.h"
|
||||||
|
#include "util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static pid_t pager_pid = 0;
|
||||||
|
|
||||||
|
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
|
||||||
|
index 5b1620974536..0e7cd1c2af12 100644
|
||||||
|
--- a/src/shared/path-lookup.c
|
||||||
|
+++ b/src/shared/path-lookup.c
|
||||||
|
@@ -19,6 +19,7 @@
|
||||||
|
#include "tmpfile-util.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
#include "util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
int xdg_user_runtime_dir(char **ret, const char *suffix) {
|
||||||
|
const char *e;
|
||||||
|
diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c
|
||||||
|
index 7cb7d8a477e9..8e7d7f9e7ca6 100644
|
||||||
|
--- a/src/shared/uid-range.c
|
||||||
|
+++ b/src/shared/uid-range.c
|
||||||
|
@@ -9,6 +9,7 @@
|
||||||
|
#include "sort-util.h"
|
||||||
|
#include "uid-range.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) {
|
||||||
|
assert(range);
|
||||||
|
diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
|
||||||
|
index 2ee6fc2f0a6a..4a9934f9c14d 100644
|
||||||
|
--- a/src/socket-proxy/socket-proxyd.c
|
||||||
|
+++ b/src/socket-proxy/socket-proxyd.c
|
||||||
|
@@ -26,6 +26,7 @@
|
||||||
|
#include "socket-util.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
#include "util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define BUFFER_SIZE (256 * 1024)
|
||||||
|
|
||||||
|
diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c
|
||||||
|
index 52217429b154..70708dedf318 100644
|
||||||
|
--- a/src/test/test-hexdecoct.c
|
||||||
|
+++ b/src/test/test-hexdecoct.c
|
||||||
|
@@ -6,6 +6,7 @@
|
||||||
|
#include "hexdecoct.h"
|
||||||
|
#include "macro.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
static void test_hexchar(void) {
|
||||||
|
assert_se(hexchar(0xa) == 'a');
|
||||||
|
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
|
||||||
|
index ca38f5608791..9d8cf4d2807b 100644
|
||||||
|
--- a/src/udev/udev-builtin-path_id.c
|
||||||
|
+++ b/src/udev/udev-builtin-path_id.c
|
||||||
|
@@ -22,6 +22,7 @@
|
||||||
|
#include "strv.h"
|
||||||
|
#include "sysexits.h"
|
||||||
|
#include "udev-builtin.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
_printf_(2,3)
|
||||||
|
static void path_prepend(char **path, const char *fmt, ...) {
|
||||||
|
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
|
||||||
|
index eb51139e519c..977cc16e9d7c 100644
|
||||||
|
--- a/src/udev/udev-event.c
|
||||||
|
+++ b/src/udev/udev-event.c
|
||||||
|
@@ -34,6 +34,7 @@
|
||||||
|
#include "udev-util.h"
|
||||||
|
#include "udev-watch.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
typedef struct Spawn {
|
||||||
|
sd_device *device;
|
||||||
|
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
|
||||||
|
index b9b350d1ef7a..2c114cc77572 100644
|
||||||
|
--- a/src/udev/udev-rules.c
|
||||||
|
+++ b/src/udev/udev-rules.c
|
||||||
|
@@ -30,6 +30,7 @@
|
||||||
|
#include "udev-rules.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
#include "virt.h"
|
||||||
|
+#include "missing_stdlib.h"
|
||||||
|
|
||||||
|
#define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d")
|
||||||
|
|
|
@ -0,0 +1,228 @@
|
||||||
|
diff -ur systemd-stable-245.5/src/basic/socket-util.h systemd-stable-245.5.new/src/basic/socket-util.h
|
||||||
|
--- systemd-stable-245.5/src/basic/socket-util.h 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/basic/socket-util.h 2020-06-30 11:39:12.196587133 +0000
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <linux/netlink.h>
|
||||||
|
#include <linux/if_ether.h>
|
||||||
|
#include <linux/if_infiniband.h>
|
||||||
|
diff -ur systemd-stable-245.5/src/libsystemd/sd-netlink/netlink-types.c systemd-stable-245.5.new/src/libsystemd/sd-netlink/netlink-types.c
|
||||||
|
--- systemd-stable-245.5/src/libsystemd/sd-netlink/netlink-types.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/libsystemd/sd-netlink/netlink-types.c 2020-06-30 11:38:29.976587133 +0000
|
||||||
|
@@ -3,6 +3,7 @@
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <linux/can/vxcan.h>
|
||||||
|
#include <linux/netlink.h>
|
||||||
|
#include <linux/rtnetlink.h>
|
||||||
|
diff -ur systemd-stable-245.5/src/libsystemd-network/sd-dhcp6-client.c systemd-stable-245.5.new/src/libsystemd-network/sd-dhcp6-client.c
|
||||||
|
--- systemd-stable-245.5/src/libsystemd-network/sd-dhcp6-client.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/libsystemd-network/sd-dhcp6-client.c 2020-06-30 11:38:29.976587133 +0000
|
||||||
|
@@ -5,7 +5,6 @@
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
-#include <linux/if_arp.h>
|
||||||
|
#include <linux/if_infiniband.h>
|
||||||
|
|
||||||
|
#include "sd-dhcp6-client.h"
|
||||||
|
diff -ur systemd-stable-245.5/src/machine/machine-dbus.c systemd-stable-245.5.new/src/machine/machine-dbus.c
|
||||||
|
--- systemd-stable-245.5/src/machine/machine-dbus.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/machine/machine-dbus.c 2020-06-30 11:38:29.976587133 +0000
|
||||||
|
@@ -3,6 +3,7 @@
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/mount.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
|
||||||
|
/* When we include libgen.h because we need dirname() we immediately
|
||||||
|
* undefine basename() since libgen.h defines it as a macro to the POSIX
|
||||||
|
diff -ur systemd-stable-245.5/src/network/netdev/bond.c systemd-stable-245.5.new/src/network/netdev/bond.c
|
||||||
|
--- systemd-stable-245.5/src/network/netdev/bond.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/netdev/bond.c 2020-06-30 11:38:29.976587133 +0000
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include "alloc-util.h"
|
||||||
|
#include "bond.h"
|
||||||
|
#include "conf-parser.h"
|
||||||
|
diff -ur systemd-stable-245.5/src/network/netdev/bridge.c systemd-stable-245.5.new/src/network/netdev/bridge.c
|
||||||
|
--- systemd-stable-245.5/src/network/netdev/bridge.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/netdev/bridge.c 2020-06-30 11:38:29.976587133 +0000
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
|
||||||
|
#include "bridge.h"
|
||||||
|
diff -ur systemd-stable-245.5/src/network/netdev/macsec.c systemd-stable-245.5.new/src/network/netdev/macsec.c
|
||||||
|
--- systemd-stable-245.5/src/network/netdev/macsec.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/netdev/macsec.c 2020-06-30 11:38:29.976587133 +0000
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <linux/if_ether.h>
|
||||||
|
#include <linux/if_macsec.h>
|
||||||
|
diff -ur systemd-stable-245.5/src/network/netdev/netdev-gperf.gperf systemd-stable-245.5.new/src/network/netdev/netdev-gperf.gperf
|
||||||
|
--- systemd-stable-245.5/src/network/netdev/netdev-gperf.gperf 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/netdev/netdev-gperf.gperf 2020-06-30 11:38:29.976587133 +0000
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
#if __GNUC__ >= 7
|
||||||
|
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
|
||||||
|
#endif
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include "bond.h"
|
||||||
|
#include "bridge.h"
|
||||||
|
diff -ur systemd-stable-245.5/src/network/netdev/netdev.c systemd-stable-245.5.new/src/network/netdev/netdev.c
|
||||||
|
--- systemd-stable-245.5/src/network/netdev/netdev.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/netdev/netdev.c 2020-06-30 11:38:29.976587133 +0000
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
diff -ur systemd-stable-245.5/src/network/networkd-brvlan.c systemd-stable-245.5.new/src/network/networkd-brvlan.c
|
||||||
|
--- systemd-stable-245.5/src/network/networkd-brvlan.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/networkd-brvlan.c 2020-06-30 11:38:29.976587133 +0000
|
||||||
|
@@ -4,6 +4,7 @@
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <linux/if_bridge.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
diff -ur systemd-stable-245.5/src/network/networkd-dhcp-common.c systemd-stable-245.5.new/src/network/networkd-dhcp-common.c
|
||||||
|
--- systemd-stable-245.5/src/network/networkd-dhcp-common.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/networkd-dhcp-common.c 2020-06-30 11:38:29.986587133 +0000
|
||||||
|
@@ -4,6 +4,7 @@
|
||||||
|
#include "escape.h"
|
||||||
|
#include "in-addr-util.h"
|
||||||
|
#include "networkd-dhcp-common.h"
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include "networkd-network.h"
|
||||||
|
#include "parse-util.h"
|
||||||
|
#include "string-table.h"
|
||||||
|
diff -ur systemd-stable-245.5/src/network/networkd-dhcp4.c systemd-stable-245.5.new/src/network/networkd-dhcp4.c
|
||||||
|
--- systemd-stable-245.5/src/network/networkd-dhcp4.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/networkd-dhcp4.c 2020-06-30 11:38:29.986587133 +0000
|
||||||
|
@@ -1,9 +1,9 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/ip.h>
|
||||||
|
#include <linux/if.h>
|
||||||
|
-#include <linux/if_arp.h>
|
||||||
|
|
||||||
|
#include "alloc-util.h"
|
||||||
|
#include "dhcp-client-internal.h"
|
||||||
|
diff -ur systemd-stable-245.5/src/network/networkd-dhcp6.c systemd-stable-245.5.new/src/network/networkd-dhcp6.c
|
||||||
|
--- systemd-stable-245.5/src/network/networkd-dhcp6.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/networkd-dhcp6.c 2020-06-30 11:38:29.986587133 +0000
|
||||||
|
@@ -3,9 +3,9 @@
|
||||||
|
Copyright © 2014 Intel Corporation. All rights reserved.
|
||||||
|
***/
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <linux/if.h>
|
||||||
|
-#include <linux/if_arp.h>
|
||||||
|
#include "sd-radv.h"
|
||||||
|
|
||||||
|
#include "sd-dhcp6-client.h"
|
||||||
|
diff -ur systemd-stable-245.5/src/network/networkd-link.c systemd-stable-245.5.new/src/network/networkd-link.c
|
||||||
|
--- systemd-stable-245.5/src/network/networkd-link.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/networkd-link.c 2020-06-30 11:38:29.986587133 +0000
|
||||||
|
@@ -1,8 +1,8 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <linux/if.h>
|
||||||
|
-#include <linux/if_arp.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "alloc-util.h"
|
||||||
|
diff -ur systemd-stable-245.5/src/network/networkd-network.c systemd-stable-245.5.new/src/network/networkd-network.c
|
||||||
|
--- systemd-stable-245.5/src/network/networkd-network.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/networkd-network.c 2020-06-30 11:38:29.986587133 +0000
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <linux/netdevice.h>
|
||||||
|
diff -ur systemd-stable-245.5/src/network/test-network-tables.c systemd-stable-245.5.new/src/network/test-network-tables.c
|
||||||
|
--- systemd-stable-245.5/src/network/test-network-tables.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/network/test-network-tables.c 2020-06-30 11:38:29.986587133 +0000
|
||||||
|
@@ -1,3 +1,4 @@
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include "bond.h"
|
||||||
|
#include "dhcp6-internal.h"
|
||||||
|
#include "dhcp6-protocol.h"
|
||||||
|
diff -ur systemd-stable-245.5/src/shared/ethtool-util.c systemd-stable-245.5.new/src/shared/ethtool-util.c
|
||||||
|
--- systemd-stable-245.5/src/shared/ethtool-util.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/shared/ethtool-util.c 2020-06-30 11:38:29.986587133 +0000
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <linux/ethtool.h>
|
||||||
|
diff -ur systemd-stable-245.5/src/shared/ethtool-util.h systemd-stable-245.5.new/src/shared/ethtool-util.h
|
||||||
|
--- systemd-stable-245.5/src/shared/ethtool-util.h 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/shared/ethtool-util.h 2020-06-30 11:38:29.986587133 +0000
|
||||||
|
@@ -3,6 +3,7 @@
|
||||||
|
|
||||||
|
#include <macro.h>
|
||||||
|
#include <net/ethernet.h>
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <linux/ethtool.h>
|
||||||
|
|
||||||
|
#include "conf-parser.h"
|
||||||
|
diff -ur systemd-stable-245.5/src/systemd/sd-netlink.h systemd-stable-245.5.new/src/systemd/sd-netlink.h
|
||||||
|
--- systemd-stable-245.5/src/systemd/sd-netlink.h 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/systemd/sd-netlink.h 2020-06-30 11:34:24.046587133 +0000
|
||||||
|
@@ -18,6 +18,7 @@
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <net/ethernet.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <linux/neighbour.h>
|
||||||
|
diff -ur systemd-stable-245.5/src/udev/net/link-config.c systemd-stable-245.5.new/src/udev/net/link-config.c
|
||||||
|
--- systemd-stable-245.5/src/udev/net/link-config.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/udev/net/link-config.c 2020-06-30 11:38:29.986587133 +0000
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include <linux/netdevice.h>
|
||||||
|
#include <netinet/ether.h>
|
||||||
|
|
||||||
|
diff -ur systemd-stable-245.5/src/udev/udev-builtin-net_setup_link.c systemd-stable-245.5.new/src/udev/udev-builtin-net_setup_link.c
|
||||||
|
--- systemd-stable-245.5/src/udev/udev-builtin-net_setup_link.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/udev/udev-builtin-net_setup_link.c 2020-06-30 11:38:29.986587133 +0000
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
|
||||||
|
+#include <netinet/if_ether.h>
|
||||||
|
#include "device-util.h"
|
||||||
|
#include "alloc-util.h"
|
||||||
|
#include "link-config.h"
|
|
@ -0,0 +1,153 @@
|
||||||
|
From 77f98727f1d19a8fb327b55c92f1a9ee7b859e9f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 14:56:21 +0800
|
||||||
|
Subject: [PATCH] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined
|
||||||
|
|
||||||
|
If the standard library doesn't provide brace
|
||||||
|
expansion users just won't get it.
|
||||||
|
|
||||||
|
Dont use GNU GLOB extentions on non-glibc systems
|
||||||
|
|
||||||
|
Conditionalize use of GLOB_ALTDIRFUNC
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
[rebased for systemd 243]
|
||||||
|
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/glob-util.c | 12 ++++++++++++
|
||||||
|
src/test/test-glob-util.c | 16 ++++++++++++++++
|
||||||
|
src/tmpfiles/tmpfiles.c | 10 ++++++++++
|
||||||
|
3 files changed, 38 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
|
||||||
|
index e3aa6c2e152b..38070b79c83a 100644
|
||||||
|
--- a/src/basic/glob-util.c
|
||||||
|
+++ b/src/basic/glob-util.c
|
||||||
|
@@ -12,6 +12,12 @@
|
||||||
|
#include "path-util.h"
|
||||||
|
#include "strv.h"
|
||||||
|
|
||||||
|
+/* Don't fail if the standard library
|
||||||
|
+ * doesn't provide brace expansion */
|
||||||
|
+#ifndef GLOB_BRACE
|
||||||
|
+#define GLOB_BRACE 0
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
static void closedir_wrapper(void* v) {
|
||||||
|
(void) closedir(v);
|
||||||
|
}
|
||||||
|
@@ -19,6 +25,7 @@ static void closedir_wrapper(void* v) {
|
||||||
|
int safe_glob(const char *path, int flags, glob_t *pglob) {
|
||||||
|
int k;
|
||||||
|
|
||||||
|
+#ifdef GLOB_ALTDIRFUNC
|
||||||
|
/* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
|
||||||
|
assert(!(flags & GLOB_ALTDIRFUNC));
|
||||||
|
|
||||||
|
@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) {
|
||||||
|
pglob->gl_lstat = lstat;
|
||||||
|
if (!pglob->gl_stat)
|
||||||
|
pglob->gl_stat = stat;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
+#ifdef GLOB_ALTDIRFUNC
|
||||||
|
k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
|
||||||
|
+#else
|
||||||
|
+ k = glob(path, flags, NULL, pglob);
|
||||||
|
+#endif
|
||||||
|
if (k == GLOB_NOMATCH)
|
||||||
|
return -ENOENT;
|
||||||
|
if (k == GLOB_NOSPACE)
|
||||||
|
diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
|
||||||
|
index 667d15335fbf..76a84443aacf 100644
|
||||||
|
--- a/src/test/test-glob-util.c
|
||||||
|
+++ b/src/test/test-glob-util.c
|
||||||
|
@@ -12,6 +12,12 @@
|
||||||
|
#include "rm-rf.h"
|
||||||
|
#include "tmpfile-util.h"
|
||||||
|
|
||||||
|
+/* Don't fail if the standard library
|
||||||
|
+ * doesn't provide brace expansion */
|
||||||
|
+#ifndef GLOB_BRACE
|
||||||
|
+#define GLOB_BRACE 0
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
static void test_glob_exists(void) {
|
||||||
|
char name[] = "/tmp/test-glob_exists.XXXXXX";
|
||||||
|
int fd = -1;
|
||||||
|
@@ -39,11 +45,13 @@ static void test_glob_no_dot(void) {
|
||||||
|
const char *fn;
|
||||||
|
|
||||||
|
_cleanup_globfree_ glob_t g = {
|
||||||
|
+#ifdef GLOB_ALTDIRFUNC
|
||||||
|
.gl_closedir = closedir_wrapper,
|
||||||
|
.gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
|
||||||
|
.gl_opendir = (void *(*)(const char *)) opendir,
|
||||||
|
.gl_lstat = lstat,
|
||||||
|
.gl_stat = stat,
|
||||||
|
+#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
int r;
|
||||||
|
@@ -51,11 +59,19 @@ static void test_glob_no_dot(void) {
|
||||||
|
assert_se(mkdtemp(template));
|
||||||
|
|
||||||
|
fn = strjoina(template, "/*");
|
||||||
|
+#ifdef GLOB_ALTDIRFUNC
|
||||||
|
r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
|
||||||
|
+#else
|
||||||
|
+ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
|
||||||
|
+#endif
|
||||||
|
assert_se(r == GLOB_NOMATCH);
|
||||||
|
|
||||||
|
fn = strjoina(template, "/.*");
|
||||||
|
+#ifdef GLOB_ALTDIRFUNC
|
||||||
|
r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
|
||||||
|
+#else
|
||||||
|
+ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
|
||||||
|
+#endif
|
||||||
|
assert_se(r == GLOB_NOMATCH);
|
||||||
|
|
||||||
|
(void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||||
|
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
|
||||||
|
index 193ed0bc781b..2f94fd2efd8f 100644
|
||||||
|
--- a/src/tmpfiles/tmpfiles.c
|
||||||
|
+++ b/src/tmpfiles/tmpfiles.c
|
||||||
|
@@ -58,6 +58,12 @@
|
||||||
|
#include "umask-util.h"
|
||||||
|
#include "user-util.h"
|
||||||
|
|
||||||
|
+/* Don't fail if the standard library
|
||||||
|
+ * doesn't provide brace expansion */
|
||||||
|
+#ifndef GLOB_BRACE
|
||||||
|
+#define GLOB_BRACE 0
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
|
||||||
|
* them in the file system. This is intended to be used to create
|
||||||
|
* properly owned directories beneath /tmp, /var/tmp, /run, which are
|
||||||
|
@@ -1850,7 +1856,9 @@ finish:
|
||||||
|
|
||||||
|
static int glob_item(Item *i, action_t action) {
|
||||||
|
_cleanup_globfree_ glob_t g = {
|
||||||
|
+#ifdef GLOB_ALTDIRFUNC
|
||||||
|
.gl_opendir = (void *(*)(const char *)) opendir_nomod,
|
||||||
|
+#endif
|
||||||
|
};
|
||||||
|
int r = 0, k;
|
||||||
|
char **fn;
|
||||||
|
@@ -1870,7 +1878,9 @@ static int glob_item(Item *i, action_t action) {
|
||||||
|
|
||||||
|
static int glob_item_recursively(Item *i, fdaction_t action) {
|
||||||
|
_cleanup_globfree_ glob_t g = {
|
||||||
|
+#ifdef GLOB_ALTDIRFUNC
|
||||||
|
.gl_opendir = (void *(*)(const char *)) opendir_nomod,
|
||||||
|
+#endif
|
||||||
|
};
|
||||||
|
int r = 0, k;
|
||||||
|
char **fn;
|
|
@ -0,0 +1,50 @@
|
||||||
|
diff -ur systemd-stable-245.5/src/basic/missing_type.h systemd-stable-245.5.new/src/basic/missing_type.h
|
||||||
|
--- systemd-stable-245.5/src/basic/missing_type.h 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/basic/missing_type.h 2020-06-30 12:13:34.326587133 +0000
|
||||||
|
@@ -10,3 +10,23 @@
|
||||||
|
#if !HAVE_CHAR16_T
|
||||||
|
#define char16_t uint16_t
|
||||||
|
#endif
|
||||||
|
+
|
||||||
|
+#ifndef FTW_ACTIONRETVAL
|
||||||
|
+#define FTW_ACTIONRETVAL 16
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef FTW_CONTINUE
|
||||||
|
+#define FTW_CONTINUE 0
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef FTW_STOP
|
||||||
|
+#define FTW_STOP 1
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef FTW_SKIP_SUBTREE
|
||||||
|
+#define FTW_SKIP_SUBTREE 2
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef FTW_SKIP_SIBLINGS
|
||||||
|
+#define FTW_SKIP_SIBLINGS 3
|
||||||
|
+#endif
|
||||||
|
Only in systemd-stable-245.5.new/src/basic: missing_type.h.orig
|
||||||
|
diff -ur systemd-stable-245.5/src/core/kmod-setup.c systemd-stable-245.5.new/src/core/kmod-setup.c
|
||||||
|
--- systemd-stable-245.5/src/core/kmod-setup.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/core/kmod-setup.c 2020-06-30 12:16:43.286587133 +0000
|
||||||
|
@@ -9,6 +9,7 @@
|
||||||
|
#include "fileio.h"
|
||||||
|
#include "kmod-setup.h"
|
||||||
|
#include "macro.h"
|
||||||
|
+#include "missing_type.h"
|
||||||
|
#include "string-util.h"
|
||||||
|
|
||||||
|
#if HAVE_KMOD
|
||||||
|
diff -ur systemd-stable-245.5/src/core/mount-setup.c systemd-stable-245.5.new/src/core/mount-setup.c
|
||||||
|
--- systemd-stable-245.5/src/core/mount-setup.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/core/mount-setup.c 2020-06-30 12:15:46.596587133 +0000
|
||||||
|
@@ -21,6 +21,7 @@
|
||||||
|
#include "label.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "macro.h"
|
||||||
|
+#include "missing_type.h"
|
||||||
|
#include "mkdir.h"
|
||||||
|
#include "mount-setup.h"
|
||||||
|
#include "mountpoint-util.h"
|
|
@ -0,0 +1,43 @@
|
||||||
|
From eed7427db98cc01db7e9b3479655d68b044bc85b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 15:03:47 +0800
|
||||||
|
Subject: [PATCH] fix missing of __register_atfork for non-glibc builds
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/process-util.c | 7 +++++++
|
||||||
|
1 file changed, 7 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
|
||||||
|
index 5de366f830e8..644f53aee005 100644
|
||||||
|
--- a/src/basic/process-util.c
|
||||||
|
+++ b/src/basic/process-util.c
|
||||||
|
@@ -18,6 +18,9 @@
|
||||||
|
#if HAVE_VALGRIND_VALGRIND_H
|
||||||
|
#include <valgrind/valgrind.h>
|
||||||
|
#endif
|
||||||
|
+#ifndef __GLIBC__
|
||||||
|
+#include <pthread.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#include "alloc-util.h"
|
||||||
|
#include "architecture.h"
|
||||||
|
@@ -1116,11 +1119,15 @@ void reset_cached_pid(void) {
|
||||||
|
cached_pid = CACHED_PID_UNSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef __GLIBC__
|
||||||
|
/* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
|
||||||
|
* headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
|
||||||
|
* libpthread, as it is part of glibc anyway. */
|
||||||
|
extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle);
|
||||||
|
extern void* __dso_handle _weak_;
|
||||||
|
+#else
|
||||||
|
+#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child)
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
pid_t getpid_cached(void) {
|
||||||
|
static bool installed = false;
|
|
@ -0,0 +1,95 @@
|
||||||
|
From 4aa91347ae975051dbe4dd2f98a1f4f459f2604f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 15:12:41 +0800
|
||||||
|
Subject: [PATCH] Use uintmax_t for handling rlim_t
|
||||||
|
|
||||||
|
PRIu{32,64} is not right format to represent rlim_t type
|
||||||
|
therefore use %ju and typecast the rlim_t variables to
|
||||||
|
uintmax_t.
|
||||||
|
|
||||||
|
Fixes portablility errors like
|
||||||
|
|
||||||
|
execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
|
||||||
|
| fprintf(f, "%s%s: " RLIM_FMT "\n",
|
||||||
|
| ^~~~~~~~
|
||||||
|
| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
|
||||||
|
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
[Rebased for v241]
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/format-util.h | 8 +-------
|
||||||
|
src/basic/rlimit-util.c | 10 +++++-----
|
||||||
|
src/core/execute.c | 4 ++--
|
||||||
|
3 files changed, 8 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/basic/format-util.h b/src/basic/format-util.h
|
||||||
|
index c47fa76ea8ff..14a78d9f5fd0 100644
|
||||||
|
--- a/src/basic/format-util.h
|
||||||
|
+++ b/src/basic/format-util.h
|
||||||
|
@@ -32,13 +32,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
|
||||||
|
# define PRI_TIMEX "li"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if SIZEOF_RLIM_T == 8
|
||||||
|
-# define RLIM_FMT "%" PRIu64
|
||||||
|
-#elif SIZEOF_RLIM_T == 4
|
||||||
|
-# define RLIM_FMT "%" PRIu32
|
||||||
|
-#else
|
||||||
|
-# error Unknown rlim_t size
|
||||||
|
-#endif
|
||||||
|
+#define RLIM_FMT "%ju"
|
||||||
|
|
||||||
|
#if SIZEOF_DEV_T == 8
|
||||||
|
# define DEV_FMT "%" PRIu64
|
||||||
|
diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
|
||||||
|
index 2dc13eabc30d..0633cc67f417 100644
|
||||||
|
--- a/src/basic/rlimit-util.c
|
||||||
|
+++ b/src/basic/rlimit-util.c
|
||||||
|
@@ -306,13 +306,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
|
||||||
|
if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
|
||||||
|
s = strdup("infinity");
|
||||||
|
else if (rl->rlim_cur >= RLIM_INFINITY)
|
||||||
|
- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
|
||||||
|
+ (void) asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
|
||||||
|
else if (rl->rlim_max >= RLIM_INFINITY)
|
||||||
|
- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
|
||||||
|
+ (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
|
||||||
|
else if (rl->rlim_cur == rl->rlim_max)
|
||||||
|
- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur);
|
||||||
|
+ (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
|
||||||
|
else
|
||||||
|
- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
|
||||||
|
+ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
|
||||||
|
|
||||||
|
if (!s)
|
||||||
|
return -ENOMEM;
|
||||||
|
@@ -403,7 +403,7 @@ int rlimit_nofile_safe(void) {
|
||||||
|
|
||||||
|
rl.rlim_cur = FD_SETSIZE;
|
||||||
|
if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
|
||||||
|
- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
|
||||||
|
+ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||||
|
index 9762dc57443c..4a3421bb3ee6 100644
|
||||||
|
--- a/src/core/execute.c
|
||||||
|
+++ b/src/core/execute.c
|
||||||
|
@@ -4567,9 +4567,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||||
|
for (i = 0; i < RLIM_NLIMITS; i++)
|
||||||
|
if (c->rlimit[i]) {
|
||||||
|
fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
|
||||||
|
- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
|
||||||
|
+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
|
||||||
|
fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
|
||||||
|
- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
|
||||||
|
+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c->ioprio_set) {
|
|
@ -0,0 +1,38 @@
|
||||||
|
diff -ur systemd-stable-245.5/src/basic/selinux-util.c systemd-stable-245.5.new/src/basic/selinux-util.c
|
||||||
|
--- systemd-stable-245.5/src/basic/selinux-util.c 2020-04-17 12:37:12.000000000 +0000
|
||||||
|
+++ systemd-stable-245.5.new/src/basic/selinux-util.c 2020-06-30 13:33:03.366587133 +0000
|
||||||
|
@@ -60,7 +60,6 @@
|
||||||
|
|
||||||
|
#if HAVE_SELINUX
|
||||||
|
usec_t before_timestamp, after_timestamp;
|
||||||
|
- struct mallinfo before_mallinfo, after_mallinfo;
|
||||||
|
|
||||||
|
if (label_hnd)
|
||||||
|
return 0;
|
||||||
|
@@ -68,7 +67,6 @@
|
||||||
|
if (!mac_selinux_use())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- before_mallinfo = mallinfo();
|
||||||
|
before_timestamp = now(CLOCK_MONOTONIC);
|
||||||
|
|
||||||
|
label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
|
||||||
|
@@ -77,16 +75,11 @@
|
||||||
|
r = security_getenforce() == 1 ? -errno : 0;
|
||||||
|
} else {
|
||||||
|
char timespan[FORMAT_TIMESPAN_MAX];
|
||||||
|
- int l;
|
||||||
|
|
||||||
|
after_timestamp = now(CLOCK_MONOTONIC);
|
||||||
|
- after_mallinfo = mallinfo();
|
||||||
|
|
||||||
|
- l = after_mallinfo.uordblks > before_mallinfo.uordblks ? after_mallinfo.uordblks - before_mallinfo.uordblks : 0;
|
||||||
|
-
|
||||||
|
- log_debug("Successfully loaded SELinux database in %s, size on heap is %iK.",
|
||||||
|
- format_timespan(timespan, sizeof(timespan), after_timestamp - before_timestamp, 0),
|
||||||
|
- (l+1023)/1024);
|
||||||
|
+ log_debug("Successfully loaded SELinux database in %s",
|
||||||
|
+ format_timespan(timespan, sizeof(timespan), after_timestamp - before_timestamp, 0));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
From 62fac5e3ff0fccd329cdc49605258b6d0e573a3e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Wed, 28 Feb 2018 21:25:22 -0800
|
||||||
|
Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/test/test-sizeof.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
|
||||||
|
index 1020e0cb3153..c65062d2562c 100644
|
||||||
|
--- a/src/test/test-sizeof.c
|
||||||
|
+++ b/src/test/test-sizeof.c
|
||||||
|
@@ -44,8 +44,10 @@ int main(void) {
|
||||||
|
info(unsigned);
|
||||||
|
info(long unsigned);
|
||||||
|
info(long long unsigned);
|
||||||
|
+#ifdef __GLIBC__
|
||||||
|
info(__syscall_ulong_t);
|
||||||
|
info(__syscall_slong_t);
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
info(float);
|
||||||
|
info(double);
|
||||||
|
@@ -63,7 +65,9 @@ int main(void) {
|
||||||
|
info(ssize_t);
|
||||||
|
info(time_t);
|
||||||
|
info(usec_t);
|
||||||
|
+#ifdef __GLIBC__
|
||||||
|
info(__time_t);
|
||||||
|
+#endif
|
||||||
|
info(pid_t);
|
||||||
|
info(uid_t);
|
||||||
|
info(gid_t);
|
|
@ -0,0 +1,97 @@
|
||||||
|
From e6f871078d8d6f076c84f908fa57af15417ab87d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andre McCurdy <armccurdy@gmail.com>
|
||||||
|
Date: Tue, 10 Oct 2017 14:33:30 -0700
|
||||||
|
Subject: [PATCH] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat()
|
||||||
|
|
||||||
|
Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right
|
||||||
|
thing to do and it's not portable (not supported by musl). See:
|
||||||
|
|
||||||
|
http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
|
||||||
|
http://www.openwall.com/lists/musl/2015/02/05/2
|
||||||
|
|
||||||
|
Note that laccess() is never passing AT_EACCESS so a lot of the
|
||||||
|
discussion in the links above doesn't apply. Note also that
|
||||||
|
(currently) all systemd callers of laccess() pass mode as F_OK, so
|
||||||
|
only check for existence of a file, not access permissions.
|
||||||
|
Therefore, in this case, the only distiction between faccessat()
|
||||||
|
with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the behaviour
|
||||||
|
for broken symlinks; laccess() on a broken symlink will succeed with
|
||||||
|
(flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
|
||||||
|
|
||||||
|
The laccess() macros was added to systemd some time ago and it's not
|
||||||
|
clear if or why it needs to return success for broken symlinks. Maybe
|
||||||
|
just historical and not actually necessary or desired behaviour?
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/fs-util.h | 22 +++++++++++++++++++++-
|
||||||
|
src/shared/base-filesystem.c | 6 +++---
|
||||||
|
2 files changed, 24 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
|
||||||
|
index 78d68be9fd85..c5dc84d41868 100644
|
||||||
|
--- a/src/basic/fs-util.h
|
||||||
|
+++ b/src/basic/fs-util.h
|
||||||
|
@@ -40,7 +40,27 @@ int fchmod_opath(int fd, mode_t m);
|
||||||
|
|
||||||
|
int fd_warn_permissions(const char *path, int fd);
|
||||||
|
|
||||||
|
-#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)
|
||||||
|
+/*
|
||||||
|
+ Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to
|
||||||
|
+ do and it's not portable (not supported by musl). See:
|
||||||
|
+
|
||||||
|
+ http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
|
||||||
|
+ http://www.openwall.com/lists/musl/2015/02/05/2
|
||||||
|
+
|
||||||
|
+ Note that laccess() is never passing AT_EACCESS so a lot of the discussion in
|
||||||
|
+ the links above doesn't apply. Note also that (currently) all systemd callers
|
||||||
|
+ of laccess() pass mode as F_OK, so only check for existence of a file, not
|
||||||
|
+ access permissions. Therefore, in this case, the only distiction between
|
||||||
|
+ faccessat() with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the
|
||||||
|
+ behaviour for broken symlinks; laccess() on a broken symlink will succeed
|
||||||
|
+ with (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
|
||||||
|
+
|
||||||
|
+ The laccess() macros was added to systemd some time ago and it's not clear if
|
||||||
|
+ or why it needs to return success for broken symlinks. Maybe just historical
|
||||||
|
+ and not actually necessary or desired behaviour?
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0)
|
||||||
|
|
||||||
|
int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
|
||||||
|
int touch(const char *path);
|
||||||
|
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
|
||||||
|
index 657407da2d37..fbd5782d84fc 100644
|
||||||
|
--- a/src/shared/base-filesystem.c
|
||||||
|
+++ b/src/shared/base-filesystem.c
|
||||||
|
@@ -54,7 +54,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
|
||||||
|
return log_error_errno(errno, "Failed to open root file system: %m");
|
||||||
|
|
||||||
|
for (i = 0; i < ELEMENTSOF(table); i ++) {
|
||||||
|
- if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
|
||||||
|
+ if (faccessat(fd, table[i].dir, F_OK, 0) >= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (table[i].target) {
|
||||||
|
@@ -62,7 +62,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
|
||||||
|
|
||||||
|
/* check if one of the targets exists */
|
||||||
|
NULSTR_FOREACH(s, table[i].target) {
|
||||||
|
- if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
|
||||||
|
+ if (faccessat(fd, s, F_OK, 0) < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* check if a specific file exists at the target path */
|
||||||
|
@@ -73,7 +73,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
|
||||||
|
if (!p)
|
||||||
|
return log_oom();
|
||||||
|
|
||||||
|
- if (faccessat(fd, p, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
|
||||||
|
+ if (faccessat(fd, p, F_OK, 0) < 0)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
From ec335ef3bb903a7eaf054103cc51411e71e6448c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Date: Sun, 27 May 2018 08:36:44 -0700
|
||||||
|
Subject: [PATCH] Define glibc compatible basename() for non-glibc systems
|
||||||
|
|
||||||
|
Fixes builds with musl, even though systemd is adamant about
|
||||||
|
using non-posix basename implementation, we have a way out
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/machine/machine-dbus.c | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
|
||||||
|
index 760ccb445cd0..0df20f3864b3 100644
|
||||||
|
--- a/src/machine/machine-dbus.c
|
||||||
|
+++ b/src/machine/machine-dbus.c
|
||||||
|
@@ -11,6 +11,11 @@
|
||||||
|
#include <libgen.h>
|
||||||
|
#undef basename
|
||||||
|
|
||||||
|
+#if !defined(__GLIBC__)
|
||||||
|
+#include <string.h>
|
||||||
|
+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#include "alloc-util.h"
|
||||||
|
#include "bus-common-errors.h"
|
||||||
|
#include "bus-internal.h"
|
|
@ -0,0 +1,39 @@
|
||||||
|
From bb28a9c870bb47dcdb1ccebaa8e3a5a86730a244 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Wed, 4 Jul 2018 15:00:44 +0800
|
||||||
|
Subject: [PATCH] Do not disable buffering when writing to oom_score_adj
|
||||||
|
|
||||||
|
On musl, disabling buffering when writing to oom_score_adj will
|
||||||
|
cause the following error.
|
||||||
|
|
||||||
|
Failed to adjust OOM setting: Invalid argument
|
||||||
|
|
||||||
|
This error appears for systemd-udevd.service and dbus.service.
|
||||||
|
This is because kernel receives '-' instead of the whole '-900'
|
||||||
|
if buffering is disabled.
|
||||||
|
|
||||||
|
This is libc implementation specific, as glibc does not have this issue.
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
[rebased for systemd 243]
|
||||||
|
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/process-util.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
|
||||||
|
index 644f53aee005..acaf13591396 100644
|
||||||
|
--- a/src/basic/process-util.c
|
||||||
|
+++ b/src/basic/process-util.c
|
||||||
|
@@ -1500,7 +1500,7 @@ int set_oom_score_adjust(int value) {
|
||||||
|
sprintf(t, "%i", value);
|
||||||
|
|
||||||
|
return write_string_file("/proc/self/oom_score_adj", t,
|
||||||
|
- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||||
|
+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
int pidfd_get_pid(int fd, pid_t *ret) {
|
|
@ -0,0 +1,60 @@
|
||||||
|
From 4938705454cf46cfe8deac8ce457d5d2432cbead Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Tue, 10 Jul 2018 15:40:17 +0800
|
||||||
|
Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
|
||||||
|
strerror_r
|
||||||
|
|
||||||
|
XSI-compliant strerror_r and GNU-specifi strerror_r are different.
|
||||||
|
|
||||||
|
int strerror_r(int errnum, char *buf, size_t buflen);
|
||||||
|
/* XSI-compliant */
|
||||||
|
|
||||||
|
char *strerror_r(int errnum, char *buf, size_t buflen);
|
||||||
|
/* GNU-specific */
|
||||||
|
|
||||||
|
We need to distinguish between them. Otherwise, we'll get an int value
|
||||||
|
assigned to (char *) variable, resulting in segment fault.
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/journal/journal-send.c | 5 +++++
|
||||||
|
src/libsystemd/sd-bus/bus-error.c | 5 +++++
|
||||||
|
2 files changed, 10 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
|
||||||
|
index 43ed756bda53..227ea64dbb48 100644
|
||||||
|
--- a/src/journal/journal-send.c
|
||||||
|
+++ b/src/journal/journal-send.c
|
||||||
|
@@ -336,7 +336,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
|
||||||
|
char* j;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
+#ifndef __GLIBC__
|
||||||
|
+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
|
||||||
|
+ j = buffer + 8 + k;
|
||||||
|
+#else
|
||||||
|
j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
|
||||||
|
+#endif
|
||||||
|
if (errno == 0) {
|
||||||
|
char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
|
||||||
|
|
||||||
|
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
|
||||||
|
index f760f0fdd21c..28a5159c4480 100644
|
||||||
|
--- a/src/libsystemd/sd-bus/bus-error.c
|
||||||
|
+++ b/src/libsystemd/sd-bus/bus-error.c
|
||||||
|
@@ -379,7 +379,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
|
||||||
|
return;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
+#ifndef __GLIBC__
|
||||||
|
+ strerror_r(error, m, k);
|
||||||
|
+ x = m;
|
||||||
|
+#else
|
||||||
|
x = strerror_r(error, m, k);
|
||||||
|
+#endif
|
||||||
|
if (errno == ERANGE || strlen(x) >= k - 1) {
|
||||||
|
free(m);
|
||||||
|
k *= 2;
|
|
@ -0,0 +1,33 @@
|
||||||
|
From 1c4c73a7cc0fb59eb68ab70699f7f51af5c163b2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 15:18:00 +0800
|
||||||
|
Subject: [PATCH] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP
|
||||||
|
|
||||||
|
for currently unknown reasons they get exported to the shared libries
|
||||||
|
even without being listed in the sym file
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
[Rebased for v241]
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/libsystemd/sd-bus/bus-error.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
|
||||||
|
index 28a5159c4480..962a4de10c56 100644
|
||||||
|
--- a/src/libsystemd/sd-bus/bus-error.c
|
||||||
|
+++ b/src/libsystemd/sd-bus/bus-error.c
|
||||||
|
@@ -54,8 +54,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = {
|
||||||
|
};
|
||||||
|
|
||||||
|
/* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */
|
||||||
|
-extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[];
|
||||||
|
-extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[];
|
||||||
|
+extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
|
||||||
|
+extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
|
||||||
|
|
||||||
|
/* Additional maps registered with sd_bus_error_add_map() are in this
|
||||||
|
* NULL terminated array */
|
|
@ -0,0 +1,28 @@
|
||||||
|
From 8303d49cabaf3ab8890ba1d266972c721dfe6ee8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 15:27:54 +0800
|
||||||
|
Subject: [PATCH] missing_type.h: add __compar_d_fn_t definition
|
||||||
|
|
||||||
|
Fix the following compile failure:
|
||||||
|
src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'?
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/missing_type.h | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
|
||||||
|
index 23602ebbd533..917d314a81bf 100644
|
||||||
|
--- a/src/basic/missing_type.h
|
||||||
|
+++ b/src/basic/missing_type.h
|
||||||
|
@@ -13,6 +13,7 @@
|
||||||
|
|
||||||
|
#ifndef __GLIBC__
|
||||||
|
typedef int (*comparison_fn_t)(const void *, const void *);
|
||||||
|
+typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __COMPAR_FN_T
|
|
@ -0,0 +1,30 @@
|
||||||
|
From 6364ff5534678c158a7fb8d4e50d0a6ce72c1ad8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 15:44:54 +0800
|
||||||
|
Subject: [PATCH] avoid redefinition of prctl_mm_map structure
|
||||||
|
|
||||||
|
Fix the following compile failure:
|
||||||
|
error: redefinition of 'struct prctl_mm_map'
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/missing_prctl.h | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
|
||||||
|
index f80cd17f346b..47e489354053 100644
|
||||||
|
--- a/src/basic/missing_prctl.h
|
||||||
|
+++ b/src/basic/missing_prctl.h
|
||||||
|
@@ -1,7 +1,9 @@
|
||||||
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
+#ifdef __GLIBC__
|
||||||
|
#include <linux/prctl.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */
|
||||||
|
#ifndef PR_CAP_AMBIENT
|
|
@ -0,0 +1,31 @@
|
||||||
|
From a05cc5fb3dc0e51682c40196285cdda34ec90783 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
Date: Mon, 25 Feb 2019 16:53:06 +0800
|
||||||
|
Subject: [PATCH] test-json.c: define M_PIl
|
||||||
|
|
||||||
|
Fix the following compile failure:
|
||||||
|
src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'?
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [musl specific]
|
||||||
|
|
||||||
|
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
src/test/test-json.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/test/test-json.c b/src/test/test-json.c
|
||||||
|
index a6613043b924..ca823ea79f05 100644
|
||||||
|
--- a/src/test/test-json.c
|
||||||
|
+++ b/src/test/test-json.c
|
||||||
|
@@ -12,6 +12,10 @@
|
||||||
|
#include "tests.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
+#ifndef M_PIl
|
||||||
|
+#define M_PIl 3.141592653589793238462643383279502884L
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
static void test_tokenizer(const char *data, ...) {
|
||||||
|
unsigned line = 0, column = 0;
|
||||||
|
void *state = NULL;
|
|
@ -0,0 +1,96 @@
|
||||||
|
From 156a5fd297b61bce31630d7a52c15614bf784843 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||||
|
Date: Sun, 31 May 2020 18:21:09 +0200
|
||||||
|
Subject: [PATCH 1/1] basic/user-util: always use base 10 for user/group
|
||||||
|
numbers
|
||||||
|
|
||||||
|
We would parse numbers with base prefixes as user identifiers. For example,
|
||||||
|
"0x2b3bfa0" would be interpreted as UID==45334432 and "01750" would be
|
||||||
|
interpreted as UID==1000. This parsing was used also in cases where either a
|
||||||
|
user/group name or number may be specified. This means that names like
|
||||||
|
0x2b3bfa0 would be ambiguous: they are a valid user name according to our
|
||||||
|
documented relaxed rules, but they would also be parsed as numeric uids.
|
||||||
|
|
||||||
|
This behaviour is definitely not expected by users, since tools generally only
|
||||||
|
accept decimal numbers (e.g. id, getent passwd), while other tools only accept
|
||||||
|
user names and thus will interpret such strings as user names without even
|
||||||
|
attempting to convert them to numbers (su, ssh). So let's follow suit and only
|
||||||
|
accept numbers in decimal notation. Effectively this means that we will reject
|
||||||
|
such strings as a username/uid/groupname/gid where strict mode is used, and try
|
||||||
|
to look up a user/group with such a name in relaxed mode.
|
||||||
|
|
||||||
|
Since the function changed is fairly low-level and fairly widely used, this
|
||||||
|
affects multiple tools: loginctl show-user/enable-linger/disable-linger foo',
|
||||||
|
the third argument in sysusers.d, fourth and fifth arguments in tmpfiles.d,
|
||||||
|
etc.
|
||||||
|
|
||||||
|
Fixes #15985.
|
||||||
|
---
|
||||||
|
src/basic/user-util.c | 2 +-
|
||||||
|
src/test/test-user-util.c | 10 ++++++++++
|
||||||
|
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- end of commit 156a5fd297b61bce31630d7a52c15614bf784843 ---
|
||||||
|
|
||||||
|
|
||||||
|
Add definition of safe_atou32_full() from commit b934ac3d6e7dcad114776ef30ee9098693e7ab7e
|
||||||
|
|
||||||
|
CVE: CVE-2020-13776
|
||||||
|
|
||||||
|
Upstream-Status: Backport [https://github.com/systemd/systemd.git]
|
||||||
|
|
||||||
|
Signed-off-by: Joe Slater <joe.slater@windriver.com>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- git.orig/src/basic/user-util.c
|
||||||
|
+++ git/src/basic/user-util.c
|
||||||
|
@@ -49,7 +49,7 @@ int parse_uid(const char *s, uid_t *ret)
|
||||||
|
assert(s);
|
||||||
|
|
||||||
|
assert_cc(sizeof(uid_t) == sizeof(uint32_t));
|
||||||
|
- r = safe_atou32(s, &uid);
|
||||||
|
+ r = safe_atou32_full(s, 10, &uid);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
--- git.orig/src/test/test-user-util.c
|
||||||
|
+++ git/src/test/test-user-util.c
|
||||||
|
@@ -48,9 +48,19 @@ static void test_parse_uid(void) {
|
||||||
|
|
||||||
|
r = parse_uid("65535", &uid);
|
||||||
|
assert_se(r == -ENXIO);
|
||||||
|
+ assert_se(uid == 100);
|
||||||
|
+
|
||||||
|
+ r = parse_uid("0x1234", &uid);
|
||||||
|
+ assert_se(r == -EINVAL);
|
||||||
|
+ assert_se(uid == 100);
|
||||||
|
+
|
||||||
|
+ r = parse_uid("01234", &uid);
|
||||||
|
+ assert_se(r == 0);
|
||||||
|
+ assert_se(uid == 1234);
|
||||||
|
|
||||||
|
r = parse_uid("asdsdas", &uid);
|
||||||
|
assert_se(r == -EINVAL);
|
||||||
|
+ assert_se(uid == 1234);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_uid_ptr(void) {
|
||||||
|
--- git.orig/src/basic/parse-util.h
|
||||||
|
+++ git/src/basic/parse-util.h
|
||||||
|
@@ -45,9 +45,13 @@ static inline int safe_atoux16(const cha
|
||||||
|
|
||||||
|
int safe_atoi16(const char *s, int16_t *ret);
|
||||||
|
|
||||||
|
-static inline int safe_atou32(const char *s, uint32_t *ret_u) {
|
||||||
|
+static inline int safe_atou32_full(const char *s, unsigned base, uint32_t *ret_u) {
|
||||||
|
assert_cc(sizeof(uint32_t) == sizeof(unsigned));
|
||||||
|
- return safe_atou(s, (unsigned*) ret_u);
|
||||||
|
+ return safe_atou_full(s, base, (unsigned*) ret_u);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static inline int safe_atou32(const char *s, uint32_t *ret_u) {
|
||||||
|
+ return safe_atou32_full(s, 0, (unsigned*) ret_u);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int safe_atoi32(const char *s, int32_t *ret_i) {
|
|
@ -0,0 +1,30 @@
|
||||||
|
From: Martin Pitt <martin.pitt@ubuntu.com>
|
||||||
|
Date: Sun, 28 Dec 2014 12:49:35 +0100
|
||||||
|
Subject: Don't enable audit by default
|
||||||
|
|
||||||
|
It causes flooding of dmesg and syslog, suppressing actually important
|
||||||
|
messages.
|
||||||
|
|
||||||
|
Don't enable it for now, until a better solution is found:
|
||||||
|
http://lists.freedesktop.org/archives/systemd-devel/2014-December/026591.html
|
||||||
|
|
||||||
|
Bug-Debian: https://bugs.debian.org/773528
|
||||||
|
---
|
||||||
|
src/journal/journald-audit.c | 5 -----
|
||||||
|
1 file changed, 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c
|
||||||
|
index 69742fa..25ef743 100644
|
||||||
|
--- a/src/journal/journald-audit.c
|
||||||
|
+++ b/src/journal/journald-audit.c
|
||||||
|
@@ -542,10 +542,5 @@ int server_open_audit(Server *s) {
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to add audit fd to event loop: %m");
|
||||||
|
|
||||||
|
- /* We are listening now, try to enable audit */
|
||||||
|
- r = enable_audit(s->audit_fd, true);
|
||||||
|
- if (r < 0)
|
||||||
|
- log_warning_errno(r, "Failed to issue audit enable call: %m");
|
||||||
|
-
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
From 3c7918deafa34313b935851171279d8fdb5cfadb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Gilbert <floppym@gentoo.org>
|
||||||
|
Date: Tue, 25 Dec 2018 22:52:50 -0500
|
||||||
|
Subject: [PATCH] path-lookup: look for generators in
|
||||||
|
{,/usr}/lib/systemd/system-generators
|
||||||
|
|
||||||
|
Bug: https://bugs.gentoo.org/625402
|
||||||
|
---
|
||||||
|
src/shared/path-lookup.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
|
||||||
|
index 442fde7b2d..6814164504 100644
|
||||||
|
--- a/src/shared/path-lookup.c
|
||||||
|
+++ b/src/shared/path-lookup.c
|
||||||
|
@@ -888,6 +888,8 @@ char **generator_binary_paths(UnitFileScope scope) {
|
||||||
|
return strv_new("/run/systemd/system-generators",
|
||||||
|
"/etc/systemd/system-generators",
|
||||||
|
"/usr/local/lib/systemd/system-generators",
|
||||||
|
+ "/usr/lib/systemd/system-generators",
|
||||||
|
+ "/lib/systemd/system-generators",
|
||||||
|
SYSTEM_GENERATOR_PATH);
|
||||||
|
|
||||||
|
case UNIT_FILE_GLOBAL:
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
From 7ccd5724afc6fa83ec6cd93dbaf4faf3671c88fc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Gilbert <floppym@gentoo.org>
|
||||||
|
Date: Mon, 27 Apr 2020 10:22:03 -0400
|
||||||
|
Subject: [PATCH] systemctl: disable synchronizaion of sysv init scripts
|
||||||
|
|
||||||
|
---
|
||||||
|
src/systemctl/systemctl.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
||||||
|
index d319d5d375..bb8419800c 100644
|
||||||
|
--- a/src/systemctl/systemctl.c
|
||||||
|
+++ b/src/systemctl/systemctl.c
|
||||||
|
@@ -6622,7 +6622,7 @@ static int import_environment(int argc, char *argv[], void *userdata) {
|
||||||
|
static int enable_sysv_units(const char *verb, char **args) {
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
|
-#if HAVE_SYSV_COMPAT
|
||||||
|
+#if 0
|
||||||
|
_cleanup_(lookup_paths_free) LookupPaths paths = {};
|
||||||
|
unsigned f = 0;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
--- a/src/login/systemd-user.m4
|
||||||
|
+++ b/src/login/systemd-user.m4
|
||||||
|
@@ -2,11 +2,7 @@
|
||||||
|
#
|
||||||
|
# Used by systemd --user instances.
|
||||||
|
|
||||||
|
-account required pam_unix.so
|
||||||
|
-m4_ifdef(`HAVE_SELINUX',
|
||||||
|
-session required pam_selinux.so close
|
||||||
|
-session required pam_selinux.so nottys open
|
||||||
|
-)m4_dnl
|
||||||
|
-session required pam_loginuid.so
|
||||||
|
+account include system-auth
|
||||||
|
+session include system-auth
|
||||||
|
session optional pam_keyinit.so force revoke
|
||||||
|
session optional pam_systemd.so
|
|
@ -0,0 +1,27 @@
|
||||||
|
# Sample nss configuration for systemd
|
||||||
|
|
||||||
|
# systemd-specific modules
|
||||||
|
# See the manual pages fore further information.
|
||||||
|
# nss-myhostname - host resolution for the local hostname
|
||||||
|
# nss-mymachines - host, user, group resolution for containers
|
||||||
|
# nss-resolve - host resolution using resolved
|
||||||
|
# nss-systemd - dynamic user/group resolution (DynamicUser in unit files)
|
||||||
|
|
||||||
|
passwd: files mymachines systemd
|
||||||
|
shadow: files
|
||||||
|
group: files mymachines systemd
|
||||||
|
gshadow: files
|
||||||
|
|
||||||
|
hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
|
||||||
|
networks: files
|
||||||
|
|
||||||
|
services: db files
|
||||||
|
protocols: db files
|
||||||
|
rpc: db files
|
||||||
|
ethers: db files
|
||||||
|
netmasks: files
|
||||||
|
netgroup: files
|
||||||
|
bootparams: files
|
||||||
|
|
||||||
|
automount: files
|
||||||
|
aliases: files
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||||
|
<pkgmetadata>
|
||||||
|
<maintainer type="project">
|
||||||
|
<email>systemd@gentoo.org</email>
|
||||||
|
<name>Gentoo systemd team</name>
|
||||||
|
</maintainer>
|
||||||
|
<slots>
|
||||||
|
<subslots>Incremented for ABI breaks in libudev or libsystemd</subslots>
|
||||||
|
</slots>
|
||||||
|
<use>
|
||||||
|
<flag name="apparmor">Enable AppArmor support</flag>
|
||||||
|
<flag name="audit">Enable support for <pkg>sys-process/audit</pkg></flag>
|
||||||
|
<flag name="cgroup-hybrid">Default to hybrid (legacy) cgroup hierarchy instead of unified (modern).</flag>
|
||||||
|
<flag name="curl">Enable support for uploading journals</flag>
|
||||||
|
<flag name="cryptsetup">Enable cryptsetup tools (includes unit generator for crypttab)</flag>
|
||||||
|
<flag name="dns-over-tls">Enable DNS-over-TLS support</flag>
|
||||||
|
<flag name="gnuefi">Enable EFI boot manager and stub loader (built using <pkg>sys-boot/gnu-efi</pkg>)</flag>
|
||||||
|
<flag name="elfutils">Enable coredump stacktraces in the journal</flag>
|
||||||
|
<flag name="gcrypt">Enable sealing of journal files using gcrypt</flag>
|
||||||
|
<flag name="homed">Enable portable home directories</flag>
|
||||||
|
<flag name="http">Enable embedded HTTP server in journald</flag>
|
||||||
|
<flag name="hwdb">Enable support for the hardware database</flag>
|
||||||
|
<flag name="importd">Enable import daemon</flag>
|
||||||
|
<flag name="kmod">Enable kernel module loading via <pkg>sys-apps/kmod</pkg></flag>
|
||||||
|
<flag name="lz4">Enable lz4 compression for the journal</flag>
|
||||||
|
<flag name="nat">Enable support for network address translation in networkd</flag>
|
||||||
|
<flag name="pkcs11">Enable PKCS#11 support for cryptsetup and homed</flag>
|
||||||
|
<flag name="pwquality">Enable password quality checking in homed</flag>
|
||||||
|
<flag name="repart">Enable support for growing/adding partitions</flag>
|
||||||
|
<flag name="qrcode">Enable qrcode output support in journal</flag>
|
||||||
|
<flag name="resolvconf">Install resolvconf symlink for systemd-resolve</flag>
|
||||||
|
<flag name="sysv-utils">Install sysvinit compatibility symlinks and manpages for init, telinit, halt, poweroff, reboot, runlevel, and shutdown</flag>
|
||||||
|
<flag name="vanilla">Disable Gentoo-specific behavior and compatibility quirks</flag>
|
||||||
|
<flag name="xkb">Depend on <pkg>x11-libs/libxkbcommon</pkg> to allow logind to control the X11 keymap</flag>
|
||||||
|
</use>
|
||||||
|
<upstream>
|
||||||
|
<remote-id type="github">systemd/systemd</remote-id>
|
||||||
|
</upstream>
|
||||||
|
</pkgmetadata>
|
|
@ -0,0 +1,566 @@
|
||||||
|
# Copyright 2011-2020 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
EAPI=7
|
||||||
|
|
||||||
|
if [[ ${PV} == 9999 ]]; then
|
||||||
|
EGIT_REPO_URI="https://github.com/systemd/systemd.git"
|
||||||
|
inherit git-r3
|
||||||
|
else
|
||||||
|
if [[ ${PV} == *.* ]]; then
|
||||||
|
MY_PN=systemd-stable
|
||||||
|
else
|
||||||
|
MY_PN=systemd
|
||||||
|
fi
|
||||||
|
MY_PV=${PV/_/-}
|
||||||
|
MY_P=${MY_PN}-${MY_PV}
|
||||||
|
S=${WORKDIR}/${MY_P}
|
||||||
|
SRC_URI="https://github.com/systemd/${MY_PN}/archive/v${MY_PV}/${MY_P}.tar.gz"
|
||||||
|
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PYTHON_COMPAT=( python3_{6,7,8} )
|
||||||
|
|
||||||
|
inherit bash-completion-r1 linux-info meson multilib-minimal ninja-utils pam python-any-r1 systemd toolchain-funcs udev usr-ldscript
|
||||||
|
|
||||||
|
DESCRIPTION="System and service manager for Linux"
|
||||||
|
HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
|
||||||
|
|
||||||
|
LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
|
||||||
|
SLOT="0/2"
|
||||||
|
IUSE="acl apparmor audit build cgroup-hybrid cryptsetup curl dns-over-tls elibc_musl elfutils +gcrypt gnuefi homed http +hwdb idn importd +kmod +lz4 lzma nat pam pcre pkcs11 policykit pwquality qrcode repart +resolvconf +seccomp selinux smack split-usr static-libs +sysv-utils test vanilla xkb"
|
||||||
|
|
||||||
|
REQUIRED_USE="
|
||||||
|
elibc_musl
|
||||||
|
homed? ( cryptsetup )
|
||||||
|
importd? ( curl gcrypt lzma )
|
||||||
|
"
|
||||||
|
RESTRICT="!test? ( test )"
|
||||||
|
|
||||||
|
MINKV="3.11"
|
||||||
|
|
||||||
|
OPENSSL_DEP=">=dev-libs/openssl-1.1.0:0="
|
||||||
|
|
||||||
|
COMMON_DEPEND=">=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}]
|
||||||
|
sys-libs/libcap:0=[${MULTILIB_USEDEP}]
|
||||||
|
acl? ( sys-apps/acl:0= )
|
||||||
|
apparmor? ( sys-libs/libapparmor:0= )
|
||||||
|
audit? ( >=sys-process/audit-2:0= )
|
||||||
|
cryptsetup? ( >=sys-fs/cryptsetup-2.0.1:0= )
|
||||||
|
curl? ( net-misc/curl:0= )
|
||||||
|
dns-over-tls? ( >=net-libs/gnutls-3.6.0:0= )
|
||||||
|
elibc_musl? ( sys-libs/musl )
|
||||||
|
elfutils? ( >=dev-libs/elfutils-0.158:0= )
|
||||||
|
gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] )
|
||||||
|
homed? ( ${OPENSSL_DEP} )
|
||||||
|
http? (
|
||||||
|
>=net-libs/libmicrohttpd-0.9.33:0=[epoll(+)]
|
||||||
|
>=net-libs/gnutls-3.1.4:0=
|
||||||
|
)
|
||||||
|
idn? ( net-dns/libidn2:= )
|
||||||
|
importd? (
|
||||||
|
app-arch/bzip2:0=
|
||||||
|
sys-libs/zlib:0=
|
||||||
|
)
|
||||||
|
kmod? ( >=sys-apps/kmod-15:0= )
|
||||||
|
lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] )
|
||||||
|
lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] )
|
||||||
|
nat? ( net-firewall/iptables:0= )
|
||||||
|
pam? ( sys-libs/pam:=[${MULTILIB_USEDEP}] )
|
||||||
|
pkcs11? ( app-crypt/p11-kit:0= )
|
||||||
|
pcre? ( dev-libs/libpcre2 )
|
||||||
|
pwquality? ( dev-libs/libpwquality:0= )
|
||||||
|
qrcode? ( media-gfx/qrencode:0= )
|
||||||
|
repart? ( ${OPENSSL_DEP} )
|
||||||
|
seccomp? ( >=sys-libs/libseccomp-2.3.3:0= )
|
||||||
|
selinux? ( sys-libs/libselinux:0= )
|
||||||
|
xkb? ( >=x11-libs/libxkbcommon-0.4.1:0= )"
|
||||||
|
|
||||||
|
# Newer linux-headers needed by ia64, bug #480218
|
||||||
|
DEPEND="${COMMON_DEPEND}
|
||||||
|
>=sys-kernel/linux-headers-${MINKV}
|
||||||
|
gnuefi? ( >=sys-boot/gnu-efi-3.0.2 )
|
||||||
|
"
|
||||||
|
|
||||||
|
# baselayout-2.2 has /run
|
||||||
|
RDEPEND="${COMMON_DEPEND}
|
||||||
|
acct-group/adm
|
||||||
|
acct-group/wheel
|
||||||
|
acct-group/kmem
|
||||||
|
acct-group/tty
|
||||||
|
acct-group/utmp
|
||||||
|
acct-group/audio
|
||||||
|
acct-group/cdrom
|
||||||
|
acct-group/dialout
|
||||||
|
acct-group/disk
|
||||||
|
acct-group/input
|
||||||
|
acct-group/kvm
|
||||||
|
acct-group/render
|
||||||
|
acct-group/tape
|
||||||
|
acct-group/video
|
||||||
|
acct-group/systemd-journal
|
||||||
|
acct-user/systemd-journal-remote
|
||||||
|
acct-user/systemd-coredump
|
||||||
|
acct-user/systemd-network
|
||||||
|
acct-user/systemd-resolve
|
||||||
|
acct-user/systemd-timesync
|
||||||
|
>=sys-apps/baselayout-2.2
|
||||||
|
selinux? ( sec-policy/selinux-base-policy[systemd] )
|
||||||
|
sysv-utils? ( !sys-apps/sysvinit )
|
||||||
|
!sysv-utils? ( sys-apps/sysvinit )
|
||||||
|
resolvconf? ( !net-dns/openresolv )
|
||||||
|
!build? ( || (
|
||||||
|
sys-apps/util-linux[kill(-)]
|
||||||
|
sys-process/procps[kill(+)]
|
||||||
|
sys-apps/coreutils[kill(-)]
|
||||||
|
) )
|
||||||
|
!sys-auth/nss-myhostname
|
||||||
|
!sys-fs/eudev
|
||||||
|
!sys-fs/udev
|
||||||
|
"
|
||||||
|
|
||||||
|
# sys-apps/dbus: the daemon only (+ build-time lib dep for tests)
|
||||||
|
PDEPEND=">=sys-apps/dbus-1.9.8[systemd]
|
||||||
|
hwdb? ( >=sys-apps/hwids-20150417[udev] )
|
||||||
|
>=sys-fs/udev-init-scripts-25
|
||||||
|
policykit? ( sys-auth/polkit )
|
||||||
|
!vanilla? ( sys-apps/gentoo-systemd-integration )"
|
||||||
|
|
||||||
|
BDEPEND="
|
||||||
|
app-arch/xz-utils:0
|
||||||
|
dev-util/gperf
|
||||||
|
>=dev-util/meson-0.46
|
||||||
|
>=dev-util/intltool-0.50
|
||||||
|
>=sys-apps/coreutils-8.16
|
||||||
|
sys-devel/m4
|
||||||
|
virtual/pkgconfig
|
||||||
|
test? ( sys-apps/dbus )
|
||||||
|
app-text/docbook-xml-dtd:4.2
|
||||||
|
app-text/docbook-xml-dtd:4.5
|
||||||
|
app-text/docbook-xsl-stylesheets
|
||||||
|
dev-libs/libxslt:0
|
||||||
|
$(python_gen_any_dep 'dev-python/lxml[${PYTHON_USEDEP}]')
|
||||||
|
"
|
||||||
|
|
||||||
|
python_check_deps() {
|
||||||
|
has_version -b "dev-python/lxml[${PYTHON_USEDEP}]"
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_pretend() {
|
||||||
|
if [[ ${MERGE_TYPE} != buildonly ]]; then
|
||||||
|
if use test && has pid-sandbox ${FEATURES}; then
|
||||||
|
ewarn "Tests are known to fail with PID sandboxing enabled."
|
||||||
|
ewarn "See https://bugs.gentoo.org/674458."
|
||||||
|
fi
|
||||||
|
|
||||||
|
local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS
|
||||||
|
~CHECKPOINT_RESTORE ~DEVTMPFS ~EPOLL ~FANOTIFY ~FHANDLE
|
||||||
|
~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SIGNALFD ~SYSFS
|
||||||
|
~TIMERFD ~TMPFS_XATTR ~UNIX
|
||||||
|
~CRYPTO_HMAC ~CRYPTO_SHA256 ~CRYPTO_USER_API_HASH
|
||||||
|
~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED
|
||||||
|
~!SYSFS_DEPRECATED_V2"
|
||||||
|
|
||||||
|
use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
|
||||||
|
use seccomp && CONFIG_CHECK+=" ~SECCOMP ~SECCOMP_FILTER"
|
||||||
|
kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
|
||||||
|
kernel_is -lt 4 7 && CONFIG_CHECK+=" ~DEVPTS_MULTIPLE_INSTANCES"
|
||||||
|
kernel_is -ge 4 10 && CONFIG_CHECK+=" ~CGROUP_BPF"
|
||||||
|
|
||||||
|
if linux_config_exists; then
|
||||||
|
local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
|
||||||
|
if [[ -n ${uevent_helper_path} ]] && [[ ${uevent_helper_path} != '""' ]]; then
|
||||||
|
ewarn "It's recommended to set an empty value to the following kernel config option:"
|
||||||
|
ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
|
||||||
|
fi
|
||||||
|
if linux_chkconfig_present X86; then
|
||||||
|
CONFIG_CHECK+=" ~DMIID"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if kernel_is -lt ${MINKV//./ }; then
|
||||||
|
ewarn "Kernel version at least ${MINKV} required"
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_extra_config
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_setup() {
|
||||||
|
:
|
||||||
|
}
|
||||||
|
|
||||||
|
src_unpack() {
|
||||||
|
default
|
||||||
|
[[ ${PV} != 9999 ]] || git-r3_src_unpack
|
||||||
|
}
|
||||||
|
|
||||||
|
src_prepare() {
|
||||||
|
# Do NOT add patches here
|
||||||
|
local PATCHES=()
|
||||||
|
|
||||||
|
[[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches )
|
||||||
|
|
||||||
|
# Add local patches here
|
||||||
|
PATCHES+=(
|
||||||
|
)
|
||||||
|
|
||||||
|
if ! use vanilla; then
|
||||||
|
PATCHES+=(
|
||||||
|
"${FILESDIR}/gentoo-Dont-enable-audit-by-default.patch"
|
||||||
|
"${FILESDIR}/gentoo-systemd-user-pam.patch"
|
||||||
|
"${FILESDIR}/gentoo-generator-path-r1.patch"
|
||||||
|
"${FILESDIR}/gentoo-systemctl-disable-sysv-sync.patch"
|
||||||
|
# Musl libc related patches
|
||||||
|
${FILESDIR}/0001-Handle-missing-gshadow.patch
|
||||||
|
${FILESDIR}/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch
|
||||||
|
${FILESDIR}/0001-do-not-disable-buffer-in-writing-files.patch
|
||||||
|
${FILESDIR}/0002-don-t-use-glibc-specific-qsort_r.patch
|
||||||
|
${FILESDIR}/0002-src-login-brightness.c-include-sys-wait.h.patch
|
||||||
|
${FILESDIR}/0003-implment-systemd-sysv-install-for-OE.patch
|
||||||
|
${FILESDIR}/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
|
||||||
|
${FILESDIR}/0003-src-basic-copy.c-include-signal.h.patch
|
||||||
|
${FILESDIR}/0004-add-fallback-parse_printf_format-implementation.patch
|
||||||
|
${FILESDIR}/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch
|
||||||
|
${FILESDIR}/0005-src-basic-missing.h-check-for-missing-strndupa.patch
|
||||||
|
${FILESDIR}/0006-Include-netinet-if_ether.h.patch
|
||||||
|
${FILESDIR}/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch
|
||||||
|
${FILESDIR}/0008-add-missing-FTW_-macros-for-musl.patch
|
||||||
|
${FILESDIR}/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch
|
||||||
|
${FILESDIR}/0011-Use-uintmax_t-for-handling-rlim_t.patch
|
||||||
|
${FILESDIR}/0012-mallinfo-musl.patch
|
||||||
|
${FILESDIR}/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
|
||||||
|
${FILESDIR}/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
|
||||||
|
${FILESDIR}/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch
|
||||||
|
${FILESDIR}/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
|
||||||
|
${FILESDIR}/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
|
||||||
|
${FILESDIR}/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
|
||||||
|
${FILESDIR}/0020-missing_type.h-add-__compar_d_fn_t-definition.patch
|
||||||
|
${FILESDIR}/0021-avoid-redefinition-of-prctl_mm_map-structure.patch
|
||||||
|
${FILESDIR}/0024-test-json.c-define-M_PIl.patch
|
||||||
|
${FILESDIR}/CVE-2020-13776.patch
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
default
|
||||||
|
}
|
||||||
|
|
||||||
|
src_configure() {
|
||||||
|
# Prevent conflicts with i686 cross toolchain, bug 559726
|
||||||
|
tc-export AR CC NM OBJCOPY RANLIB
|
||||||
|
|
||||||
|
python_setup
|
||||||
|
|
||||||
|
multilib-minimal_src_configure
|
||||||
|
}
|
||||||
|
|
||||||
|
meson_use() {
|
||||||
|
usex "$1" true false
|
||||||
|
}
|
||||||
|
|
||||||
|
meson_multilib() {
|
||||||
|
if multilib_is_native_abi; then
|
||||||
|
echo true
|
||||||
|
else
|
||||||
|
echo false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
meson_multilib_native_use() {
|
||||||
|
if multilib_is_native_abi && use "$1"; then
|
||||||
|
echo true
|
||||||
|
else
|
||||||
|
echo false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
multilib_src_configure() {
|
||||||
|
local myconf=(
|
||||||
|
--localstatedir="${EPREFIX}/var"
|
||||||
|
-Dsupport-url="https://gentoo.org/support/"
|
||||||
|
-Dpamlibdir="$(getpam_mod_dir)"
|
||||||
|
# avoid bash-completion dep
|
||||||
|
-Dbashcompletiondir="$(get_bashcompdir)"
|
||||||
|
# make sure we get /bin:/sbin in PATH
|
||||||
|
-Dsplit-usr=$(usex split-usr true false)
|
||||||
|
-Dsplit-bin=true
|
||||||
|
-Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")"
|
||||||
|
-Drootlibdir="${EPREFIX}/usr/$(get_libdir)"
|
||||||
|
# Avoid infinite exec recursion, bug 642724
|
||||||
|
-Dtelinit-path="${EPREFIX}/lib/sysvinit/telinit"
|
||||||
|
# no deps
|
||||||
|
-Dima=true
|
||||||
|
-Ddefault-hierarchy=$(usex cgroup-hybrid hybrid unified)
|
||||||
|
# Optional components/dependencies
|
||||||
|
-Dacl=$(meson_multilib_native_use acl)
|
||||||
|
-Dapparmor=$(meson_multilib_native_use apparmor)
|
||||||
|
-Daudit=$(meson_multilib_native_use audit)
|
||||||
|
-Dlibcryptsetup=$(meson_multilib_native_use cryptsetup)
|
||||||
|
-Dlibcurl=$(meson_multilib_native_use curl)
|
||||||
|
-Ddns-over-tls=$(meson_multilib_native_use dns-over-tls)
|
||||||
|
-Delfutils=$(meson_multilib_native_use elfutils)
|
||||||
|
-Dgcrypt=$(meson_use gcrypt)
|
||||||
|
-Dgnu-efi=$(meson_multilib_native_use gnuefi)
|
||||||
|
-Defi-libdir="${ESYSROOT}/usr/$(get_libdir)"
|
||||||
|
-Dhomed=$(meson_multilib_native_use homed)
|
||||||
|
-Dhwdb=$(meson_multilib_native_use hwdb)
|
||||||
|
-Dmicrohttpd=$(meson_multilib_native_use http)
|
||||||
|
-Didn=$(meson_multilib_native_use idn)
|
||||||
|
-Dimportd=$(meson_multilib_native_use importd)
|
||||||
|
-Dbzip2=$(meson_multilib_native_use importd)
|
||||||
|
-Dzlib=$(meson_multilib_native_use importd)
|
||||||
|
-Dkmod=$(meson_multilib_native_use kmod)
|
||||||
|
-Dlz4=$(meson_use lz4)
|
||||||
|
-Dxz=$(meson_use lzma)
|
||||||
|
-Dlibiptc=$(meson_multilib_native_use nat)
|
||||||
|
-Dpam=$(meson_use pam)
|
||||||
|
-Dp11kit=$(meson_multilib_native_use pkcs11)
|
||||||
|
-Dpcre2=$(meson_multilib_native_use pcre)
|
||||||
|
-Dpolkit=$(meson_multilib_native_use policykit)
|
||||||
|
-Dpwquality=$(meson_multilib_native_use pwquality)
|
||||||
|
-Dqrencode=$(meson_multilib_native_use qrcode)
|
||||||
|
-Drepart=$(meson_multilib_native_use repart)
|
||||||
|
-Dseccomp=$(meson_multilib_native_use seccomp)
|
||||||
|
-Dselinux=$(meson_multilib_native_use selinux)
|
||||||
|
-Dsmack=$(meson_multilib_native_use smack)
|
||||||
|
-Ddbus=$(meson_multilib_native_use test)
|
||||||
|
-Dxkbcommon=$(meson_multilib_native_use xkb)
|
||||||
|
-Dntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
|
||||||
|
# Breaks screen, tmux, etc.
|
||||||
|
-Ddefault-kill-user-processes=false
|
||||||
|
-Dcreate-log-dirs=false
|
||||||
|
# Musl related settings
|
||||||
|
-Dgshadow=false
|
||||||
|
-Dlocaled=false
|
||||||
|
-Dnss-myhostname=false
|
||||||
|
-Dnss-systemd=false
|
||||||
|
-Dnss-mymachines=false
|
||||||
|
-Dnss-resolve=false
|
||||||
|
-Dsysusers=false
|
||||||
|
-Duserdb=false
|
||||||
|
-Dutmp=false
|
||||||
|
# multilib options
|
||||||
|
-Dbacklight=$(meson_multilib)
|
||||||
|
-Dbinfmt=$(meson_multilib)
|
||||||
|
-Dcoredump=$(meson_multilib)
|
||||||
|
-Denvironment-d=$(meson_multilib)
|
||||||
|
-Dfirstboot=$(meson_multilib)
|
||||||
|
-Dhibernate=$(meson_multilib)
|
||||||
|
-Dhostnamed=$(meson_multilib)
|
||||||
|
-Dldconfig=$(meson_multilib)
|
||||||
|
-Dman=$(meson_multilib)
|
||||||
|
-Dnetworkd=$(meson_multilib)
|
||||||
|
-Dquotacheck=$(meson_multilib)
|
||||||
|
-Drandomseed=$(meson_multilib)
|
||||||
|
-Drfkill=$(meson_multilib)
|
||||||
|
-Dtimedated=$(meson_multilib)
|
||||||
|
-Dtimesyncd=$(meson_multilib)
|
||||||
|
-Dtmpfiles=$(meson_multilib)
|
||||||
|
-Dvconsole=$(meson_multilib)
|
||||||
|
|
||||||
|
# static-libs
|
||||||
|
-Dstatic-libsystemd=$(usex static-libs true false)
|
||||||
|
-Dstatic-libudev=$(usex static-libs true false)
|
||||||
|
)
|
||||||
|
|
||||||
|
meson_src_configure "${myconf[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
multilib_src_compile() {
|
||||||
|
eninja
|
||||||
|
}
|
||||||
|
|
||||||
|
multilib_src_test() {
|
||||||
|
unset DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR
|
||||||
|
meson_src_test
|
||||||
|
}
|
||||||
|
|
||||||
|
multilib_src_install() {
|
||||||
|
DESTDIR="${D}" eninja install
|
||||||
|
}
|
||||||
|
|
||||||
|
multilib_src_install_all() {
|
||||||
|
local rootprefix=$(usex split-usr '' /usr)
|
||||||
|
|
||||||
|
# meson doesn't know about docdir
|
||||||
|
mv "${ED}"/usr/share/doc/{systemd,${PF}} || die
|
||||||
|
|
||||||
|
einstalldocs
|
||||||
|
dodoc "${FILESDIR}"/nsswitch.conf
|
||||||
|
|
||||||
|
if ! use resolvconf; then
|
||||||
|
rm -f "${ED}${rootprefix}"/sbin/resolvconf || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm "${ED}"/etc/init.d/README || die
|
||||||
|
rm "${ED}${rootprefix}"/lib/systemd/system-generators/systemd-sysv-generator || die
|
||||||
|
|
||||||
|
if ! use sysv-utils; then
|
||||||
|
rm "${ED}${rootprefix}"/sbin/{halt,init,poweroff,reboot,runlevel,shutdown,telinit} || die
|
||||||
|
rm "${ED}"/usr/share/man/man1/init.1 || die
|
||||||
|
rm "${ED}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! use resolvconf && ! use sysv-utils; then
|
||||||
|
rmdir "${ED}${rootprefix}"/sbin || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Preserve empty dirs in /etc & /var, bug #437008
|
||||||
|
keepdir /etc/{binfmt.d,modules-load.d,tmpfiles.d}
|
||||||
|
keepdir /etc/kernel/install.d
|
||||||
|
keepdir /etc/systemd/{network,system,user}
|
||||||
|
keepdir /etc/udev/rules.d
|
||||||
|
|
||||||
|
if use hwdb; then
|
||||||
|
keepdir /etc/udev/hwdb.d
|
||||||
|
fi
|
||||||
|
|
||||||
|
keepdir "${rootprefix}"/lib/systemd/{system-sleep,system-shutdown}
|
||||||
|
keepdir /usr/lib/{binfmt.d,modules-load.d}
|
||||||
|
keepdir /usr/lib/systemd/user-generators
|
||||||
|
keepdir /var/lib/systemd
|
||||||
|
keepdir /var/log/journal
|
||||||
|
|
||||||
|
# Symlink /etc/sysctl.conf for easy migration.
|
||||||
|
dosym ../sysctl.conf /etc/sysctl.d/99-sysctl.conf
|
||||||
|
|
||||||
|
if use hwdb; then
|
||||||
|
rm -r "${ED}${rootprefix}"/lib/udev/hwdb.d || die
|
||||||
|
fi
|
||||||
|
|
||||||
|
if use split-usr; then
|
||||||
|
# Avoid breaking boot/reboot
|
||||||
|
dosym ../../../lib/systemd/systemd /usr/lib/systemd/systemd
|
||||||
|
dosym ../../../lib/systemd/systemd-shutdown /usr/lib/systemd/systemd-shutdown
|
||||||
|
fi
|
||||||
|
|
||||||
|
gen_usr_ldscript -a systemd udev
|
||||||
|
}
|
||||||
|
|
||||||
|
migrate_locale() {
|
||||||
|
local envd_locale_def="${EROOT}/etc/env.d/02locale"
|
||||||
|
local envd_locale=( "${EROOT}"/etc/env.d/??locale )
|
||||||
|
local locale_conf="${EROOT}/etc/locale.conf"
|
||||||
|
|
||||||
|
if [[ ! -L ${locale_conf} && ! -e ${locale_conf} ]]; then
|
||||||
|
# If locale.conf does not exist...
|
||||||
|
if [[ -e ${envd_locale} ]]; then
|
||||||
|
# ...either copy env.d/??locale if there's one
|
||||||
|
ebegin "Moving ${envd_locale} to ${locale_conf}"
|
||||||
|
mv "${envd_locale}" "${locale_conf}"
|
||||||
|
eend ${?} || FAIL=1
|
||||||
|
else
|
||||||
|
# ...or create a dummy default
|
||||||
|
ebegin "Creating ${locale_conf}"
|
||||||
|
cat > "${locale_conf}" <<-EOF
|
||||||
|
# This file has been created by the sys-apps/systemd ebuild.
|
||||||
|
# See locale.conf(5) and localectl(1).
|
||||||
|
|
||||||
|
# LANG=${LANG}
|
||||||
|
EOF
|
||||||
|
eend ${?} || FAIL=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -L ${envd_locale} ]]; then
|
||||||
|
# now, if env.d/??locale is not a symlink (to locale.conf)...
|
||||||
|
if [[ -e ${envd_locale} ]]; then
|
||||||
|
# ...warn the user that he has duplicate locale settings
|
||||||
|
ewarn
|
||||||
|
ewarn "To ensure consistent behavior, you should replace ${envd_locale}"
|
||||||
|
ewarn "with a symlink to ${locale_conf}. Please migrate your settings"
|
||||||
|
ewarn "and create the symlink with the following command:"
|
||||||
|
ewarn "ln -s -n -f ../locale.conf ${envd_locale}"
|
||||||
|
ewarn
|
||||||
|
else
|
||||||
|
# ...or just create the symlink if there's nothing here
|
||||||
|
ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink"
|
||||||
|
ln -n -s ../locale.conf "${envd_locale_def}"
|
||||||
|
eend ${?} || FAIL=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
save_enabled_units() {
|
||||||
|
ENABLED_UNITS=()
|
||||||
|
type systemctl &>/dev/null || return
|
||||||
|
for x; do
|
||||||
|
if systemctl --quiet --root="${ROOT:-/}" is-enabled "${x}"; then
|
||||||
|
ENABLED_UNITS+=( "${x}" )
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_preinst() {
|
||||||
|
save_enabled_units {machines,remote-{cryptsetup,fs}}.target getty@tty1.service
|
||||||
|
|
||||||
|
if ! use split-usr; then
|
||||||
|
local dir
|
||||||
|
for dir in bin sbin lib; do
|
||||||
|
if [[ ! ${EROOT}/${dir} -ef ${EROOT}/usr/${dir} ]]; then
|
||||||
|
eerror "\"${EROOT}/${dir}\" and \"${EROOT}/usr/${dir}\" are not merged."
|
||||||
|
eerror "One of them should be a symbolic link to the other one."
|
||||||
|
FAIL=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ ${FAIL} ]]; then
|
||||||
|
eerror "Migration to system layout with merged directories must be performed before"
|
||||||
|
eerror "rebuilding ${CATEGORY}/${PN} with USE=\"-split-usr\" to avoid run-time breakage."
|
||||||
|
die "System layout with split directories still used"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_postinst() {
|
||||||
|
systemd_update_catalog
|
||||||
|
|
||||||
|
# Keep this here in case the database format changes so it gets updated
|
||||||
|
# when required. Despite that this file is owned by sys-apps/hwids.
|
||||||
|
if has_version "sys-apps/hwids[udev]"; then
|
||||||
|
udevadm hwdb --update --root="${EROOT}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
udev_reload || FAIL=1
|
||||||
|
|
||||||
|
# Bug 465468, make sure locales are respect, and ensure consistency
|
||||||
|
# between OpenRC & systemd
|
||||||
|
migrate_locale
|
||||||
|
|
||||||
|
systemd_reenable systemd-networkd.service systemd-resolved.service
|
||||||
|
|
||||||
|
if [[ ${ENABLED_UNITS[@]} ]]; then
|
||||||
|
systemctl --root="${ROOT:-/}" enable "${ENABLED_UNITS[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z ${REPLACING_VERSIONS} ]]; then
|
||||||
|
if type systemctl &>/dev/null; then
|
||||||
|
systemctl --root="${ROOT:-/}" enable getty@.service remote-fs.target || FAIL=1
|
||||||
|
fi
|
||||||
|
elog "To enable a useful set of services, run the following:"
|
||||||
|
elog " systemctl preset-all --preset-mode=enable-only"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -L ${EROOT}/var/lib/systemd/timesync ]]; then
|
||||||
|
rm "${EROOT}/var/lib/systemd/timesync"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z ${ROOT} && -d /run/systemd/system ]]; then
|
||||||
|
ebegin "Reexecuting system manager"
|
||||||
|
systemctl daemon-reexec
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${FAIL} ]]; then
|
||||||
|
eerror "One of the postinst commands failed. Please check the postinst output"
|
||||||
|
eerror "for errors. You may need to clean up your system and/or try installing"
|
||||||
|
eerror "systemd again."
|
||||||
|
eerror
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_prerm() {
|
||||||
|
# If removing systemd completely, remove the catalog database.
|
||||||
|
if [[ ! ${REPLACED_BY_VERSION} ]]; then
|
||||||
|
rm -f -v "${EROOT}"/var/lib/systemd/catalog/database
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in New Issue