mirror of
https://github.com/systemd/systemd
synced 2026-04-11 01:24:50 +02:00
Compare commits
No commits in common. "5c18815dc067e4bcca91a5b066a0f2b442b04592" and "4bb3437cad715c40c1a183adbb3a7687ec6f6ac6" have entirely different histories.
5c18815dc0
...
4bb3437cad
2
NEWS
2
NEWS
@ -688,7 +688,7 @@ CHANGES WITH 250 in spe:
|
|||||||
are now ordered the same as other units. Effectively, they will be
|
are now ordered the same as other units. Effectively, they will be
|
||||||
started earlier (if something actually pulled them in) and stopped
|
started earlier (if something actually pulled them in) and stopped
|
||||||
later, similarly to normal mount units that are part of
|
later, similarly to normal mount units that are part of
|
||||||
fs-local.target. This change should be invisible to users, but
|
fs-local.target. This change should be invisibile to users, but
|
||||||
should prevent those units from being stopped too early during
|
should prevent those units from being stopped too early during
|
||||||
shutdown.
|
shutdown.
|
||||||
|
|
||||||
|
|||||||
@ -234,14 +234,13 @@
|
|||||||
<citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||||
for more details. When the MAC address is specified, the policies are applied to the
|
for more details. When the MAC address is specified, the policies are applied to the
|
||||||
interface which has the address. When no MAC address is specified, the policies are applied
|
interface which has the address. When no MAC address is specified, the policies are applied
|
||||||
to all interfaces. This kernel command line argument can be specified multiple times.</para>
|
to all interfaces. This kernel command line argument can be specified multiple times. This
|
||||||
|
argument is not directly read from <command>systemd-udevd</command>, but read and converted
|
||||||
<para>This argument is not directly read by <command>systemd-udevd</command>, but is instead
|
to a .link file by <command>systemd-network-generator</command>. So, to make this argument
|
||||||
converted to a .link file by
|
take effect, <filename>systemd-network-generator.service</filename> must be enabled and
|
||||||
<citerefentry><refentrytitle>systemd-network-generator.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
|
started before starting <filename>systemd-udevd.service</filename>. See
|
||||||
For this argument to take effect, <filename>systemd-network-generator.service</filename> must be
|
<citerefentry><refentrytitle>systemd-network-generator.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||||
enabled.</para>
|
for more details about the service.</para>
|
||||||
|
|
||||||
<para>Example:
|
<para>Example:
|
||||||
<programlisting>net.ifname-policy=keep,kernel,path,slot,onboard,01:23:45:67:89:ab
|
<programlisting>net.ifname-policy=keep,kernel,path,slot,onboard,01:23:45:67:89:ab
|
||||||
net.ifname-policy=keep,kernel,path,slot,onboard,mac</programlisting>
|
net.ifname-policy=keep,kernel,path,slot,onboard,mac</programlisting>
|
||||||
|
|||||||
42
meson.build
42
meson.build
@ -1836,15 +1836,11 @@ if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
|
|||||||
if conf.get('HAVE_TPM2') == 1
|
if conf.get('HAVE_TPM2') == 1
|
||||||
cryptsetup_token_systemd_tpm2 = shared_library(
|
cryptsetup_token_systemd_tpm2 = shared_library(
|
||||||
'cryptsetup-token-systemd-tpm2',
|
'cryptsetup-token-systemd-tpm2',
|
||||||
cryptsetup_token_systemd_tpm2_sources,
|
|
||||||
include_directories : includes,
|
|
||||||
link_args : ['-shared',
|
link_args : ['-shared',
|
||||||
'-Wl,--version-script=' + cryptsetup_token_sym_path],
|
'-Wl,--version-script=' + cryptsetup_token_sym_path],
|
||||||
link_with : [lib_cryptsetup_token_common,
|
dependencies : libshared_deps + [libcryptsetup, versiondep],
|
||||||
libshared],
|
link_with : [libshared],
|
||||||
dependencies : [libcryptsetup,
|
link_whole : [cryptsetup_token_systemd_tpm2_static],
|
||||||
tpm2,
|
|
||||||
versiondep],
|
|
||||||
link_depends : cryptsetup_token_sym,
|
link_depends : cryptsetup_token_sym,
|
||||||
install_rpath : rootlibexecdir,
|
install_rpath : rootlibexecdir,
|
||||||
install : true,
|
install : true,
|
||||||
@ -1854,15 +1850,11 @@ if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
|
|||||||
if conf.get('HAVE_LIBFIDO2') == 1
|
if conf.get('HAVE_LIBFIDO2') == 1
|
||||||
cryptsetup_token_systemd_fido2 = shared_library(
|
cryptsetup_token_systemd_fido2 = shared_library(
|
||||||
'cryptsetup-token-systemd-fido2',
|
'cryptsetup-token-systemd-fido2',
|
||||||
cryptsetup_token_systemd_fido2_sources,
|
|
||||||
include_directories : includes,
|
|
||||||
link_args : ['-shared',
|
link_args : ['-shared',
|
||||||
'-Wl,--version-script=' + cryptsetup_token_sym_path],
|
'-Wl,--version-script=' + cryptsetup_token_sym_path],
|
||||||
link_with : [lib_cryptsetup_token_common,
|
dependencies : libshared_deps + [libcryptsetup, versiondep],
|
||||||
libshared],
|
link_with : [libshared],
|
||||||
dependencies : [libcryptsetup,
|
link_whole : [cryptsetup_token_systemd_fido2_static],
|
||||||
libfido2,
|
|
||||||
versiondep],
|
|
||||||
link_depends : cryptsetup_token_sym,
|
link_depends : cryptsetup_token_sym,
|
||||||
install_rpath : rootlibexecdir,
|
install_rpath : rootlibexecdir,
|
||||||
install : true,
|
install : true,
|
||||||
@ -1872,15 +1864,11 @@ if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
|
|||||||
if conf.get('HAVE_P11KIT') == 1
|
if conf.get('HAVE_P11KIT') == 1
|
||||||
cryptsetup_token_systemd_pkcs11 = shared_library(
|
cryptsetup_token_systemd_pkcs11 = shared_library(
|
||||||
'cryptsetup-token-systemd-pkcs11',
|
'cryptsetup-token-systemd-pkcs11',
|
||||||
cryptsetup_token_systemd_pkcs11_sources,
|
|
||||||
include_directories : includes,
|
|
||||||
link_args : ['-shared',
|
link_args : ['-shared',
|
||||||
'-Wl,--version-script=' + cryptsetup_token_sym_path],
|
'-Wl,--version-script=' + cryptsetup_token_sym_path],
|
||||||
link_with : [lib_cryptsetup_token_common,
|
dependencies : libshared_deps + [libcryptsetup, versiondep],
|
||||||
libshared],
|
link_with : [libshared],
|
||||||
dependencies : [libcryptsetup,
|
link_whole : [cryptsetup_token_systemd_pkcs11_static],
|
||||||
libp11kit,
|
|
||||||
versiondep],
|
|
||||||
link_depends : cryptsetup_token_sym,
|
link_depends : cryptsetup_token_sym,
|
||||||
install_rpath : rootlibexecdir,
|
install_rpath : rootlibexecdir,
|
||||||
install : true,
|
install : true,
|
||||||
@ -2776,8 +2764,7 @@ if conf.get('ENABLE_IMPORTD') == 1
|
|||||||
'systemd-pull',
|
'systemd-pull',
|
||||||
systemd_pull_sources,
|
systemd_pull_sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
link_with : [libshared,
|
link_with : [libshared],
|
||||||
lib_import_common],
|
|
||||||
dependencies : [versiondep,
|
dependencies : [versiondep,
|
||||||
libcurl,
|
libcurl,
|
||||||
lib_openssl_or_gcrypt,
|
lib_openssl_or_gcrypt,
|
||||||
@ -2792,8 +2779,7 @@ if conf.get('ENABLE_IMPORTD') == 1
|
|||||||
'systemd-import',
|
'systemd-import',
|
||||||
systemd_import_sources,
|
systemd_import_sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
link_with : [libshared,
|
link_with : [libshared],
|
||||||
lib_import_common],
|
|
||||||
dependencies : [libcurl,
|
dependencies : [libcurl,
|
||||||
libz,
|
libz,
|
||||||
libbzip2,
|
libbzip2,
|
||||||
@ -2806,8 +2792,7 @@ if conf.get('ENABLE_IMPORTD') == 1
|
|||||||
'systemd-import-fs',
|
'systemd-import-fs',
|
||||||
systemd_import_fs_sources,
|
systemd_import_fs_sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
link_with : [libshared,
|
link_with : [libshared],
|
||||||
lib_import_common],
|
|
||||||
install_rpath : rootlibexecdir,
|
install_rpath : rootlibexecdir,
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : rootlibexecdir)
|
install_dir : rootlibexecdir)
|
||||||
@ -2816,8 +2801,7 @@ if conf.get('ENABLE_IMPORTD') == 1
|
|||||||
'systemd-export',
|
'systemd-export',
|
||||||
systemd_export_sources,
|
systemd_export_sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
link_with : [libshared,
|
link_with : [libshared],
|
||||||
lib_import_common],
|
|
||||||
dependencies : [libcurl,
|
dependencies : [libcurl,
|
||||||
libz,
|
libz,
|
||||||
libbzip2,
|
libbzip2,
|
||||||
|
|||||||
@ -18,7 +18,6 @@ enable machines.target
|
|||||||
enable getty@.service
|
enable getty@.service
|
||||||
enable systemd-timesyncd.service
|
enable systemd-timesyncd.service
|
||||||
enable systemd-networkd.service
|
enable systemd-networkd.service
|
||||||
enable systemd-network-generator.service
|
|
||||||
enable systemd-resolved.service
|
enable systemd-resolved.service
|
||||||
enable systemd-homed.service
|
enable systemd-homed.service
|
||||||
enable systemd-userdbd.socket
|
enable systemd-userdbd.socket
|
||||||
@ -38,6 +37,7 @@ disable exit.target
|
|||||||
disable systemd-networkd-wait-online.service
|
disable systemd-networkd-wait-online.service
|
||||||
disable systemd-time-wait-sync.service
|
disable systemd-time-wait-sync.service
|
||||||
disable systemd-boot-check-no-failures.service
|
disable systemd-boot-check-no-failures.service
|
||||||
|
disable systemd-network-generator.service
|
||||||
disable proc-sys-fs-binfmt_misc.mount
|
disable proc-sys-fs-binfmt_misc.mount
|
||||||
|
|
||||||
disable syslog.socket
|
disable syslog.socket
|
||||||
|
|||||||
@ -199,6 +199,8 @@ int cg_enumerate_subgroups(const char *controller, const char *path, DIR **_d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int cg_read_subgroup(DIR *d, char **fn) {
|
int cg_read_subgroup(DIR *d, char **fn) {
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
assert(d);
|
assert(d);
|
||||||
assert(fn);
|
assert(fn);
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ static int files_add(
|
|||||||
|
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
const char *dirpath;
|
const char *dirpath;
|
||||||
|
struct dirent *de;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(h);
|
assert(h);
|
||||||
|
|||||||
@ -14,8 +14,19 @@ bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pu
|
|||||||
struct dirent *readdir_ensure_type(DIR *d);
|
struct dirent *readdir_ensure_type(DIR *d);
|
||||||
struct dirent *readdir_no_dot(DIR *dirp);
|
struct dirent *readdir_no_dot(DIR *dirp);
|
||||||
|
|
||||||
|
#define FOREACH_DIRENT(de, d, on_error) \
|
||||||
|
for (de = readdir_ensure_type(d);; de = readdir_ensure_type(d)) \
|
||||||
|
if (!de) { \
|
||||||
|
if (errno > 0) { \
|
||||||
|
on_error; \
|
||||||
|
} \
|
||||||
|
break; \
|
||||||
|
} else if (hidden_or_backup_file((de)->d_name)) \
|
||||||
|
continue; \
|
||||||
|
else
|
||||||
|
|
||||||
#define FOREACH_DIRENT_ALL(de, d, on_error) \
|
#define FOREACH_DIRENT_ALL(de, d, on_error) \
|
||||||
for (struct dirent *(de) = readdir_ensure_type(d);; (de) = readdir_ensure_type(d)) \
|
for (de = readdir_ensure_type(d);; de = readdir_ensure_type(d)) \
|
||||||
if (!de) { \
|
if (!de) { \
|
||||||
if (errno > 0) { \
|
if (errno > 0) { \
|
||||||
on_error; \
|
on_error; \
|
||||||
@ -23,12 +34,6 @@ struct dirent *readdir_no_dot(DIR *dirp);
|
|||||||
break; \
|
break; \
|
||||||
} else
|
} else
|
||||||
|
|
||||||
#define FOREACH_DIRENT(de, d, on_error) \
|
|
||||||
FOREACH_DIRENT_ALL(de, d, on_error) \
|
|
||||||
if (hidden_or_backup_file((de)->d_name)) \
|
|
||||||
continue; \
|
|
||||||
else
|
|
||||||
|
|
||||||
/* Maximum space one dirent structure might require at most */
|
/* Maximum space one dirent structure might require at most */
|
||||||
#define DIRENT_SIZE_MAX CONST_MAX(sizeof(struct dirent), offsetof(struct dirent, d_name) + NAME_MAX + 1)
|
#define DIRENT_SIZE_MAX CONST_MAX(sizeof(struct dirent), offsetof(struct dirent, d_name) + NAME_MAX + 1)
|
||||||
|
|
||||||
|
|||||||
@ -300,6 +300,7 @@ int close_all_fds_without_malloc(const int except[], size_t n_except) {
|
|||||||
|
|
||||||
int close_all_fds(const int except[], size_t n_except) {
|
int close_all_fds(const int except[], size_t n_except) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert(n_except == 0 || except);
|
assert(n_except == 0 || except);
|
||||||
|
|||||||
@ -533,6 +533,7 @@ int mkfifoat_atomic(int dirfd, const char *path, mode_t mode) {
|
|||||||
int get_files_in_directory(const char *path, char ***list) {
|
int get_files_in_directory(const char *path, char ***list) {
|
||||||
_cleanup_strv_free_ char **l = NULL;
|
_cleanup_strv_free_ char **l = NULL;
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
|
|
||||||
assert(path);
|
assert(path);
|
||||||
|
|||||||
@ -158,19 +158,20 @@ static int add_locales_from_archive(Set *locales) {
|
|||||||
|
|
||||||
static int add_locales_from_libdir (Set *locales) {
|
static int add_locales_from_libdir (Set *locales) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *entry;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
dir = opendir("/usr/lib/locale");
|
dir = opendir("/usr/lib/locale");
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return errno == ENOENT ? 0 : -errno;
|
return errno == ENOENT ? 0 : -errno;
|
||||||
|
|
||||||
FOREACH_DIRENT(de, dir, return -errno) {
|
FOREACH_DIRENT(entry, dir, return -errno) {
|
||||||
char *z;
|
char *z;
|
||||||
|
|
||||||
if (de->d_type != DT_DIR)
|
if (entry->d_type != DT_DIR)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
z = normalize_locale(de->d_name);
|
z = normalize_locale(entry->d_name);
|
||||||
if (!z)
|
if (!z)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|||||||
@ -428,7 +428,7 @@ libbasic = static_library(
|
|||||||
libcap,
|
libcap,
|
||||||
libm],
|
libm],
|
||||||
c_args : ['-fvisibility=default'],
|
c_args : ['-fvisibility=default'],
|
||||||
build_by_default : false)
|
install : false)
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
@ -443,5 +443,4 @@ libbasic_gcrypt = static_library(
|
|||||||
basic_gcrypt_sources,
|
basic_gcrypt_sources,
|
||||||
include_directories : basic_includes,
|
include_directories : basic_includes,
|
||||||
dependencies : [libgcrypt],
|
dependencies : [libgcrypt],
|
||||||
c_args : ['-fvisibility=default'],
|
c_args : ['-fvisibility=default'])
|
||||||
build_by_default : false)
|
|
||||||
|
|||||||
@ -89,6 +89,7 @@ int open_extension_release(const char *root, const char *extension, char **ret_p
|
|||||||
return log_debug_errno(r, "Cannot open %s/usr/lib/extension-release.d/, ignoring: %m", root);
|
return log_debug_errno(r, "Cannot open %s/usr/lib/extension-release.d/, ignoring: %m", root);
|
||||||
|
|
||||||
r = -ENOENT;
|
r = -ENOENT;
|
||||||
|
struct dirent *de;
|
||||||
FOREACH_DIRENT(de, extension_release_dir, return -errno) {
|
FOREACH_DIRENT(de, extension_release_dir, return -errno) {
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
|
|||||||
@ -276,6 +276,7 @@ int unit_file_build_name_map(
|
|||||||
|
|
||||||
STRV_FOREACH(dir, (char**) lp->search_path) {
|
STRV_FOREACH(dir, (char**) lp->search_path) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
d = opendir(*dir);
|
d = opendir(*dir);
|
||||||
if (!d) {
|
if (!d) {
|
||||||
|
|||||||
@ -118,6 +118,7 @@ void in_initrd_force(bool value) {
|
|||||||
int on_ac_power(void) {
|
int on_ac_power(void) {
|
||||||
bool found_offline = false, found_online = false;
|
bool found_offline = false, found_online = false;
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
d = opendir("/sys/class/power_supply");
|
d = opendir("/sys/class/power_supply");
|
||||||
|
|||||||
@ -98,6 +98,7 @@ static int detect_vm_device_tree(void) {
|
|||||||
r = read_one_line_file("/proc/device-tree/hypervisor/compatible", &hvtype);
|
r = read_one_line_file("/proc/device-tree/hypervisor/compatible", &hvtype);
|
||||||
if (r == -ENOENT) {
|
if (r == -ENOENT) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *dent;
|
||||||
|
|
||||||
if (access("/proc/device-tree/ibm,partition-name", F_OK) == 0 &&
|
if (access("/proc/device-tree/ibm,partition-name", F_OK) == 0 &&
|
||||||
access("/proc/device-tree/hmc-managed?", F_OK) == 0 &&
|
access("/proc/device-tree/hmc-managed?", F_OK) == 0 &&
|
||||||
@ -113,9 +114,9 @@ static int detect_vm_device_tree(void) {
|
|||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
FOREACH_DIRENT(de, dir, return -errno)
|
FOREACH_DIRENT(dent, dir, return -errno)
|
||||||
if (strstr(de->d_name, "fw-cfg")) {
|
if (strstr(dent->d_name, "fw-cfg")) {
|
||||||
log_debug("Virtualization QEMU: \"fw-cfg\" present in /proc/device-tree/%s", de->d_name);
|
log_debug("Virtualization QEMU: \"fw-cfg\" present in /proc/device-tree/%s", dent->d_name);
|
||||||
return VIRTUALIZATION_QEMU;
|
return VIRTUALIZATION_QEMU;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -184,6 +184,7 @@ finish:
|
|||||||
|
|
||||||
static int enumerate_binaries(const char *esp_path, const char *path, const char *prefix) {
|
static int enumerate_binaries(const char *esp_path, const char *path, const char *prefix) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
const char *p;
|
const char *p;
|
||||||
int c = 0, r;
|
int c = 0, r;
|
||||||
|
|
||||||
@ -657,6 +658,7 @@ static int copy_one_file(const char *esp_path, const char *name, bool force) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int install_binaries(const char *esp_path, bool force) {
|
static int install_binaries(const char *esp_path, bool force) {
|
||||||
|
struct dirent *de;
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
@ -848,6 +850,7 @@ static int install_variables(const char *esp_path,
|
|||||||
|
|
||||||
static int remove_boot_efi(const char *esp_path) {
|
static int remove_boot_efi(const char *esp_path) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
const char *p;
|
const char *p;
|
||||||
int r, c = 0;
|
int r, c = 0;
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
|
||||||
/* Include the implementation directly, so we can poke at some internals. */
|
/* Inlcude the implementation directly, so we can poke at some internals. */
|
||||||
#include "bcd.c"
|
#include "bcd.c"
|
||||||
|
|
||||||
static void load_bcd(const char *path, void **ret_bcd, size_t *ret_bcd_len) {
|
static void load_bcd(const char *path, void **ret_bcd, size_t *ret_bcd_len) {
|
||||||
|
|||||||
@ -287,6 +287,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
|
|||||||
|
|
||||||
static int have_ask_password(void) {
|
static int have_ask_password(void) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
dir = opendir("/run/systemd/ask-password");
|
dir = opendir("/run/systemd/ask-password");
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
@ -296,9 +297,10 @@ static int have_ask_password(void) {
|
|||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, return -errno)
|
FOREACH_DIRENT_ALL(de, dir, return -errno) {
|
||||||
if (startswith(de->d_name, "ask."))
|
if (startswith(de->d_name, "ask."))
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -184,8 +184,7 @@ libcore = static_library(
|
|||||||
libapparmor,
|
libapparmor,
|
||||||
libselinux,
|
libselinux,
|
||||||
libmount,
|
libmount,
|
||||||
libacl],
|
libacl])
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
core_includes = [includes, include_directories('.')]
|
core_includes = [includes, include_directories('.')]
|
||||||
|
|
||||||
|
|||||||
@ -51,6 +51,7 @@ static int fdopen_unlocked_at(int dfd, const char *dir, const char *name, int *s
|
|||||||
static int write_access2_rules(const char *srcdir) {
|
static int write_access2_rules(const char *srcdir) {
|
||||||
_cleanup_close_ int load2_fd = -1, change_fd = -1;
|
_cleanup_close_ int load2_fd = -1, change_fd = -1;
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *entry;
|
||||||
int dfd = -1, r = 0;
|
int dfd = -1, r = 0;
|
||||||
|
|
||||||
load2_fd = open("/sys/fs/smackfs/load2", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
|
load2_fd = open("/sys/fs/smackfs/load2", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
|
||||||
@ -123,6 +124,7 @@ static int write_access2_rules(const char *srcdir) {
|
|||||||
static int write_cipso2_rules(const char *srcdir) {
|
static int write_cipso2_rules(const char *srcdir) {
|
||||||
_cleanup_close_ int cipso2_fd = -1;
|
_cleanup_close_ int cipso2_fd = -1;
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *entry;
|
||||||
int dfd = -1, r = 0;
|
int dfd = -1, r = 0;
|
||||||
|
|
||||||
cipso2_fd = open("/sys/fs/smackfs/cipso2", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
|
cipso2_fd = open("/sys/fs/smackfs/cipso2", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
|
||||||
@ -182,6 +184,7 @@ static int write_cipso2_rules(const char *srcdir) {
|
|||||||
static int write_netlabel_rules(const char *srcdir) {
|
static int write_netlabel_rules(const char *srcdir) {
|
||||||
_cleanup_fclose_ FILE *dst = NULL;
|
_cleanup_fclose_ FILE *dst = NULL;
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *entry;
|
||||||
int dfd = -1, r = 0;
|
int dfd = -1, r = 0;
|
||||||
|
|
||||||
dst = fopen("/sys/fs/smackfs/netlabel", "we");
|
dst = fopen("/sys/fs/smackfs/netlabel", "we");
|
||||||
|
|||||||
@ -142,6 +142,7 @@ int coredump_vacuum(int exclude_fd, uint64_t keep_free, uint64_t max_use) {
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
_cleanup_(vacuum_candidate_hashmap_freep) Hashmap *h = NULL;
|
_cleanup_(vacuum_candidate_hashmap_freep) Hashmap *h = NULL;
|
||||||
VacuumCandidate *worst = NULL;
|
VacuumCandidate *worst = NULL;
|
||||||
|
struct dirent *de;
|
||||||
uint64_t sum = 0;
|
uint64_t sum = 0;
|
||||||
|
|
||||||
rewinddir(d);
|
rewinddir(d);
|
||||||
|
|||||||
@ -580,6 +580,7 @@ static int compose_open_fds(pid_t pid, char **open_fds) {
|
|||||||
_cleanup_free_ char *buffer = NULL;
|
_cleanup_free_ char *buffer = NULL;
|
||||||
_cleanup_fclose_ FILE *stream = NULL;
|
_cleanup_fclose_ FILE *stream = NULL;
|
||||||
const char *fddelim = "", *path;
|
const char *fddelim = "", *path;
|
||||||
|
struct dirent *dent = NULL;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -599,20 +600,20 @@ static int compose_open_fds(pid_t pid, char **open_fds) {
|
|||||||
if (!stream)
|
if (!stream)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
FOREACH_DIRENT(de, proc_fd_dir, return -errno) {
|
FOREACH_DIRENT(dent, proc_fd_dir, return -errno) {
|
||||||
_cleanup_fclose_ FILE *fdinfo = NULL;
|
_cleanup_fclose_ FILE *fdinfo = NULL;
|
||||||
_cleanup_free_ char *fdname = NULL;
|
_cleanup_free_ char *fdname = NULL;
|
||||||
_cleanup_close_ int fd = -1;
|
_cleanup_close_ int fd = -1;
|
||||||
|
|
||||||
r = readlinkat_malloc(dirfd(proc_fd_dir), de->d_name, &fdname);
|
r = readlinkat_malloc(dirfd(proc_fd_dir), dent->d_name, &fdname);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
fprintf(stream, "%s%s:%s\n", fddelim, de->d_name, fdname);
|
fprintf(stream, "%s%s:%s\n", fddelim, dent->d_name, fdname);
|
||||||
fddelim = "\n";
|
fddelim = "\n";
|
||||||
|
|
||||||
/* Use the directory entry from /proc/[pid]/fd with /proc/[pid]/fdinfo */
|
/* Use the directory entry from /proc/[pid]/fd with /proc/[pid]/fdinfo */
|
||||||
fd = openat(proc_fdinfo_fd, de->d_name, O_NOFOLLOW|O_CLOEXEC|O_RDONLY);
|
fd = openat(proc_fdinfo_fd, dent->d_name, O_NOFOLLOW|O_CLOEXEC|O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@ -1,28 +1,64 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
|
if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
|
||||||
|
|
||||||
|
cryptsetup_token_c_args = ['-fvisibility=hidden']
|
||||||
|
|
||||||
cryptsetup_token_sym = files('cryptsetup-token.sym')
|
cryptsetup_token_sym = files('cryptsetup-token.sym')
|
||||||
cryptsetup_token_sym_path = meson.current_source_dir() / 'cryptsetup-token.sym'
|
cryptsetup_token_sym_path = meson.current_source_dir() / 'cryptsetup-token.sym'
|
||||||
|
|
||||||
lib_cryptsetup_token_common = static_library(
|
if conf.get('HAVE_TPM2') == 1
|
||||||
'cryptsetup-token-common',
|
cryptsetup_token_systemd_tpm2_sources = files('''
|
||||||
'cryptsetup-token.h',
|
cryptsetup-token-systemd-tpm2.c
|
||||||
'cryptsetup-token-util.h',
|
cryptsetup-token.h
|
||||||
'cryptsetup-token-util.c',
|
cryptsetup-token-util.h
|
||||||
include_directories : includes,
|
cryptsetup-token-util.c
|
||||||
link_with : libshared,
|
luks2-tpm2.c
|
||||||
build_by_default : false)
|
luks2-tpm2.h
|
||||||
|
'''.split())
|
||||||
|
|
||||||
cryptsetup_token_systemd_tpm2_sources = files(
|
cryptsetup_token_systemd_tpm2_static = static_library(
|
||||||
'cryptsetup-token-systemd-tpm2.c',
|
'cryptsetup-token-systemd-tpm2_static',
|
||||||
'luks2-tpm2.c',
|
cryptsetup_token_systemd_tpm2_sources,
|
||||||
'luks2-tpm2.h')
|
include_directories : includes,
|
||||||
|
dependencies : libshared_deps + [libcryptsetup, versiondep],
|
||||||
|
c_args : cryptsetup_token_c_args)
|
||||||
|
endif
|
||||||
|
|
||||||
cryptsetup_token_systemd_fido2_sources = files(
|
if conf.get('HAVE_LIBFIDO2') == 1
|
||||||
'cryptsetup-token-systemd-fido2.c',
|
cryptsetup_token_systemd_fido2_sources = files('''
|
||||||
'luks2-fido2.c',
|
cryptsetup-token-systemd-fido2.c
|
||||||
'luks2-fido2.h')
|
cryptsetup-token.h
|
||||||
|
cryptsetup-token-util.h
|
||||||
|
cryptsetup-token-util.c
|
||||||
|
luks2-fido2.c
|
||||||
|
luks2-fido2.h
|
||||||
|
'''.split())
|
||||||
|
|
||||||
cryptsetup_token_systemd_pkcs11_sources = files(
|
cryptsetup_token_systemd_fido2_static = static_library(
|
||||||
'cryptsetup-token-systemd-pkcs11.c',
|
'cryptsetup-token-systemd-fido2_static',
|
||||||
'luks2-pkcs11.c',
|
cryptsetup_token_systemd_fido2_sources,
|
||||||
'luks2-pkcs11.h')
|
include_directories : includes,
|
||||||
|
dependencies : libshared_deps + [libcryptsetup, versiondep],
|
||||||
|
c_args : cryptsetup_token_c_args)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if conf.get('HAVE_P11KIT') == 1
|
||||||
|
cryptsetup_token_systemd_pkcs11_sources = files('''
|
||||||
|
cryptsetup-token-systemd-pkcs11.c
|
||||||
|
cryptsetup-token.h
|
||||||
|
cryptsetup-token-util.h
|
||||||
|
cryptsetup-token-util.c
|
||||||
|
luks2-pkcs11.c
|
||||||
|
luks2-pkcs11.h
|
||||||
|
'''.split())
|
||||||
|
|
||||||
|
cryptsetup_token_systemd_pkcs11_static = static_library(
|
||||||
|
'cryptsetup-token-systemd-pkcs11_static',
|
||||||
|
cryptsetup_token_systemd_pkcs11_sources,
|
||||||
|
include_directories : includes,
|
||||||
|
dependencies : libshared_deps + [libcryptsetup, versiondep],
|
||||||
|
c_args : cryptsetup_token_c_args)
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|||||||
@ -290,6 +290,7 @@ static int enumerate_dir(
|
|||||||
const char *path, bool dropins) {
|
const char *path, bool dropins) {
|
||||||
|
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
_cleanup_strv_free_ char **files = NULL, **dirs = NULL;
|
_cleanup_strv_free_ char **files = NULL, **dirs = NULL;
|
||||||
size_t n_files = 0, n_dirs = 0;
|
size_t n_files = 0, n_dirs = 0;
|
||||||
char **t;
|
char **t;
|
||||||
|
|||||||
@ -447,6 +447,7 @@ unlink_this_file:
|
|||||||
|
|
||||||
static int manager_enumerate_records(Manager *m) {
|
static int manager_enumerate_records(Manager *m) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
||||||
@ -918,6 +919,7 @@ static int manager_assess_image(
|
|||||||
|
|
||||||
int manager_enumerate_images(Manager *m) {
|
int manager_enumerate_images(Manager *m) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
||||||
|
|||||||
@ -159,7 +159,7 @@ int import_fork_tar_c(const char *path, pid_t *ret) {
|
|||||||
int import_mangle_os_tree(const char *path) {
|
int import_mangle_os_tree(const char *path) {
|
||||||
_cleanup_free_ char *child = NULL, *t = NULL, *joined = NULL;
|
_cleanup_free_ char *child = NULL, *t = NULL, *joined = NULL;
|
||||||
_cleanup_closedir_ DIR *d = NULL, *cd = NULL;
|
_cleanup_closedir_ DIR *d = NULL, *cd = NULL;
|
||||||
struct dirent *dent;
|
struct dirent *de;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -183,8 +183,8 @@ int import_mangle_os_tree(const char *path) {
|
|||||||
return log_error_errno(r, "Failed to open directory '%s': %m", path);
|
return log_error_errno(r, "Failed to open directory '%s': %m", path);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
dent = readdir_no_dot(d);
|
de = readdir_no_dot(d);
|
||||||
if (!dent) {
|
if (!de) {
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
return log_error_errno(errno, "Failed to iterate through directory '%s': %m", path);
|
return log_error_errno(errno, "Failed to iterate through directory '%s': %m", path);
|
||||||
|
|
||||||
@ -192,13 +192,13 @@ int import_mangle_os_tree(const char *path) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
child = strdup(dent->d_name);
|
child = strdup(de->d_name);
|
||||||
if (!child)
|
if (!child)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
dent = readdir_no_dot(d);
|
de = readdir_no_dot(d);
|
||||||
if (dent) {
|
if (de) {
|
||||||
if (errno != 0)
|
if (errno != 0)
|
||||||
return log_error_errno(errno, "Failed to iterate through directory '%s': %m", path);
|
return log_error_errno(errno, "Failed to iterate through directory '%s': %m", path);
|
||||||
|
|
||||||
|
|||||||
@ -1,53 +1,62 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
systemd_importd_sources = files(
|
systemd_importd_sources = files('''
|
||||||
'importd.c')
|
importd.c
|
||||||
|
'''.split())
|
||||||
|
|
||||||
systemd_pull_sources = files(
|
systemd_pull_sources = files('''
|
||||||
'pull.c',
|
pull.c
|
||||||
'pull-raw.c',
|
pull-raw.c
|
||||||
'pull-raw.h',
|
pull-raw.h
|
||||||
'pull-tar.c',
|
pull-tar.c
|
||||||
'pull-tar.h',
|
pull-tar.h
|
||||||
'pull-job.c',
|
pull-job.c
|
||||||
'pull-job.h',
|
pull-job.h
|
||||||
'pull-common.c',
|
pull-common.c
|
||||||
'pull-common.h',
|
pull-common.h
|
||||||
'curl-util.c',
|
import-common.c
|
||||||
'curl-util.h')
|
import-common.h
|
||||||
|
import-compress.c
|
||||||
|
import-compress.h
|
||||||
|
curl-util.c
|
||||||
|
curl-util.h
|
||||||
|
qcow2-util.c
|
||||||
|
qcow2-util.h
|
||||||
|
'''.split())
|
||||||
|
|
||||||
systemd_import_sources = files(
|
systemd_import_sources = files('''
|
||||||
'import.c',
|
import.c
|
||||||
'import-raw.c',
|
import-raw.c
|
||||||
'import-raw.h',
|
import-raw.h
|
||||||
'import-tar.c',
|
import-tar.c
|
||||||
'import-tar.h')
|
import-tar.h
|
||||||
|
import-common.c
|
||||||
|
import-common.h
|
||||||
|
import-compress.c
|
||||||
|
import-compress.h
|
||||||
|
qcow2-util.c
|
||||||
|
qcow2-util.h
|
||||||
|
'''.split())
|
||||||
|
|
||||||
systemd_import_fs_sources = files(
|
systemd_import_fs_sources = files('''
|
||||||
'import-fs.c')
|
import-fs.c
|
||||||
|
import-common.c
|
||||||
|
import-common.h
|
||||||
|
'''.split())
|
||||||
|
|
||||||
systemd_export_sources = files(
|
systemd_export_sources = files('''
|
||||||
'export.c',
|
export.c
|
||||||
'export-tar.c',
|
export-tar.c
|
||||||
'export-tar.h',
|
export-tar.h
|
||||||
'export-raw.c',
|
export-raw.c
|
||||||
'export-raw.h')
|
export-raw.h
|
||||||
|
import-common.c
|
||||||
|
import-common.h
|
||||||
|
import-compress.c
|
||||||
|
import-compress.h
|
||||||
|
'''.split())
|
||||||
|
|
||||||
if conf.get('ENABLE_IMPORTD') == 1
|
if conf.get('ENABLE_IMPORTD') == 1
|
||||||
lib_import_common = static_library(
|
|
||||||
'import-common',
|
|
||||||
'import-common.c',
|
|
||||||
'import-common.h',
|
|
||||||
'import-compress.c',
|
|
||||||
'import-compress.h',
|
|
||||||
'qcow2-util.c',
|
|
||||||
'qcow2-util.h',
|
|
||||||
include_directories : includes,
|
|
||||||
dependencies : [libbzip2,
|
|
||||||
libxz,
|
|
||||||
libz],
|
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
install_data('org.freedesktop.import1.conf',
|
install_data('org.freedesktop.import1.conf',
|
||||||
install_dir : dbuspolicydir)
|
install_dir : dbuspolicydir)
|
||||||
install_data('org.freedesktop.import1.service',
|
install_data('org.freedesktop.import1.service',
|
||||||
|
|||||||
@ -59,6 +59,7 @@ int pull_find_old_etags(
|
|||||||
}
|
}
|
||||||
|
|
||||||
_cleanup_strv_free_ char **ans = NULL;
|
_cleanup_strv_free_ char **ans = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, d, return -errno) {
|
FOREACH_DIRENT_ALL(de, d, return -errno) {
|
||||||
_cleanup_free_ char *u = NULL;
|
_cleanup_free_ char *u = NULL;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ libsystemd_journal_remote = static_library(
|
|||||||
libgnutls,
|
libgnutls,
|
||||||
libxz,
|
libxz,
|
||||||
liblz4],
|
liblz4],
|
||||||
build_by_default : false)
|
install : false)
|
||||||
|
|
||||||
systemd_journal_remote_sources = files('''
|
systemd_journal_remote_sources = files('''
|
||||||
journal-remote-main.c
|
journal-remote-main.c
|
||||||
|
|||||||
@ -90,6 +90,7 @@ static int determine_path_usage(
|
|||||||
uint64_t *ret_free) {
|
uint64_t *ret_free) {
|
||||||
|
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
struct statvfs ss;
|
struct statvfs ss;
|
||||||
|
|
||||||
assert(s);
|
assert(s);
|
||||||
|
|||||||
@ -848,6 +848,7 @@ static int stdout_stream_restore(Server *s, const char *fname, int fd) {
|
|||||||
|
|
||||||
int server_restore_streams(Server *s, FDSet *fds) {
|
int server_restore_streams(Server *s, FDSet *fds) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
const char *path;
|
const char *path;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ libjournal_core = static_library(
|
|||||||
sources,
|
sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
dependencies: threads,
|
dependencies: threads,
|
||||||
build_by_default : false)
|
install : false)
|
||||||
|
|
||||||
journal_includes = [includes, include_directories('.')]
|
journal_includes = [includes, include_directories('.')]
|
||||||
|
|
||||||
|
|||||||
@ -49,8 +49,7 @@ sources = files('''
|
|||||||
libsystemd_network = static_library(
|
libsystemd_network = static_library(
|
||||||
'systemd-network',
|
'systemd-network',
|
||||||
sources,
|
sources,
|
||||||
include_directories : includes,
|
include_directories : includes)
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
libsystemd_network_includes = [includes, include_directories('.')]
|
libsystemd_network_includes = [includes, include_directories('.')]
|
||||||
|
|
||||||
|
|||||||
@ -166,12 +166,12 @@ libsystemd_c_args = ['-fvisibility=default']
|
|||||||
libsystemd_static = static_library(
|
libsystemd_static = static_library(
|
||||||
'systemd_static',
|
'systemd_static',
|
||||||
libsystemd_sources,
|
libsystemd_sources,
|
||||||
|
install : false,
|
||||||
include_directories : libsystemd_includes,
|
include_directories : libsystemd_includes,
|
||||||
c_args : libsystemd_c_args,
|
|
||||||
link_with : libbasic,
|
link_with : libbasic,
|
||||||
dependencies : [threads,
|
dependencies : [threads,
|
||||||
librt],
|
librt],
|
||||||
build_by_default : false)
|
c_args : libsystemd_c_args)
|
||||||
|
|
||||||
libsystemd_sym = files('libsystemd.sym')
|
libsystemd_sym = files('libsystemd.sym')
|
||||||
libsystemd_sym_path = meson.current_source_dir() / 'libsystemd.sym'
|
libsystemd_sym_path = meson.current_source_dir() / 'libsystemd.sym'
|
||||||
|
|||||||
@ -350,6 +350,7 @@ static bool match_sysname(sd_device_enumerator *enumerator, const char *sysname)
|
|||||||
static int enumerator_scan_dir_and_add_devices(sd_device_enumerator *enumerator, const char *basedir, const char *subdir1, const char *subdir2) {
|
static int enumerator_scan_dir_and_add_devices(sd_device_enumerator *enumerator, const char *basedir, const char *subdir1, const char *subdir2) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
char *path;
|
char *path;
|
||||||
|
struct dirent *dent;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert(enumerator);
|
assert(enumerator);
|
||||||
@ -368,18 +369,18 @@ static int enumerator_scan_dir_and_add_devices(sd_device_enumerator *enumerator,
|
|||||||
/* this is necessarily racey, so ignore missing directories */
|
/* this is necessarily racey, so ignore missing directories */
|
||||||
return (errno == ENOENT && (subdir1 || subdir2)) ? 0 : -errno;
|
return (errno == ENOENT && (subdir1 || subdir2)) ? 0 : -errno;
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, return -errno) {
|
FOREACH_DIRENT_ALL(dent, dir, return -errno) {
|
||||||
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
|
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
|
||||||
char syspath[strlen(path) + 1 + strlen(de->d_name) + 1];
|
char syspath[strlen(path) + 1 + strlen(dent->d_name) + 1];
|
||||||
int initialized, k;
|
int initialized, k;
|
||||||
|
|
||||||
if (de->d_name[0] == '.')
|
if (dent->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!match_sysname(enumerator, de->d_name))
|
if (!match_sysname(enumerator, dent->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
(void) sprintf(syspath, "%s%s", path, de->d_name);
|
(void) sprintf(syspath, "%s%s", path, dent->d_name);
|
||||||
|
|
||||||
k = sd_device_new_from_syspath(&device, syspath);
|
k = sd_device_new_from_syspath(&device, syspath);
|
||||||
if (k < 0) {
|
if (k < 0) {
|
||||||
@ -460,6 +461,7 @@ static bool match_subsystem(sd_device_enumerator *enumerator, const char *subsys
|
|||||||
static int enumerator_scan_dir(sd_device_enumerator *enumerator, const char *basedir, const char *subdir, const char *subsystem) {
|
static int enumerator_scan_dir(sd_device_enumerator *enumerator, const char *basedir, const char *subdir, const char *subsystem) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
char *path;
|
char *path;
|
||||||
|
struct dirent *dent;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
path = strjoina("/sys/", basedir);
|
path = strjoina("/sys/", basedir);
|
||||||
@ -470,16 +472,16 @@ static int enumerator_scan_dir(sd_device_enumerator *enumerator, const char *bas
|
|||||||
|
|
||||||
log_debug("sd-device-enumerator: Scanning %s", path);
|
log_debug("sd-device-enumerator: Scanning %s", path);
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, return -errno) {
|
FOREACH_DIRENT_ALL(dent, dir, return -errno) {
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
if (de->d_name[0] == '.')
|
if (dent->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!match_subsystem(enumerator, subsystem ? : de->d_name))
|
if (!match_subsystem(enumerator, subsystem ? : dent->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
k = enumerator_scan_dir_and_add_devices(enumerator, basedir, de->d_name, subdir);
|
k = enumerator_scan_dir_and_add_devices(enumerator, basedir, dent->d_name, subdir);
|
||||||
if (k < 0)
|
if (k < 0)
|
||||||
r = k;
|
r = k;
|
||||||
}
|
}
|
||||||
@ -490,6 +492,7 @@ static int enumerator_scan_dir(sd_device_enumerator *enumerator, const char *bas
|
|||||||
static int enumerator_scan_devices_tag(sd_device_enumerator *enumerator, const char *tag) {
|
static int enumerator_scan_devices_tag(sd_device_enumerator *enumerator, const char *tag) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
char *path;
|
char *path;
|
||||||
|
struct dirent *dent;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert(enumerator);
|
assert(enumerator);
|
||||||
@ -506,15 +509,15 @@ static int enumerator_scan_devices_tag(sd_device_enumerator *enumerator, const c
|
|||||||
|
|
||||||
/* TODO: filter away subsystems? */
|
/* TODO: filter away subsystems? */
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, return -errno) {
|
FOREACH_DIRENT_ALL(dent, dir, return -errno) {
|
||||||
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
|
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
|
||||||
const char *subsystem, *sysname;
|
const char *subsystem, *sysname;
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
if (de->d_name[0] == '.')
|
if (dent->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
k = sd_device_new_from_device_id(&device, de->d_name);
|
k = sd_device_new_from_device_id(&device, dent->d_name);
|
||||||
if (k < 0) {
|
if (k < 0) {
|
||||||
if (k != -ENODEV)
|
if (k != -ENODEV)
|
||||||
/* this is necessarily racy, so ignore missing devices */
|
/* this is necessarily racy, so ignore missing devices */
|
||||||
@ -622,23 +625,24 @@ static int parent_add_child(sd_device_enumerator *enumerator, const char *path)
|
|||||||
|
|
||||||
static int parent_crawl_children(sd_device_enumerator *enumerator, const char *path, unsigned maxdepth) {
|
static int parent_crawl_children(sd_device_enumerator *enumerator, const char *path, unsigned maxdepth) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *dent;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
dir = opendir(path);
|
dir = opendir(path);
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return log_debug_errno(errno, "sd-device-enumerator: Failed to open parent directory %s: %m", path);
|
return log_debug_errno(errno, "sd-device-enumerator: Failed to open parent directory %s: %m", path);
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, return -errno) {
|
FOREACH_DIRENT_ALL(dent, dir, return -errno) {
|
||||||
_cleanup_free_ char *child = NULL;
|
_cleanup_free_ char *child = NULL;
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
if (de->d_name[0] == '.')
|
if (dent->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (de->d_type != DT_DIR)
|
if (dent->d_type != DT_DIR)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
child = path_join(path, de->d_name);
|
child = path_join(path, dent->d_name);
|
||||||
if (!child)
|
if (!child)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|||||||
@ -1747,6 +1747,7 @@ _public_ const char *sd_device_get_property_next(sd_device *device, const char *
|
|||||||
static int device_sysattrs_read_all_internal(sd_device *device, const char *subdir) {
|
static int device_sysattrs_read_all_internal(sd_device *device, const char *subdir) {
|
||||||
_cleanup_free_ char *path_dir = NULL;
|
_cleanup_free_ char *path_dir = NULL;
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *dent;
|
||||||
const char *syspath;
|
const char *syspath;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -1778,33 +1779,33 @@ static int device_sysattrs_read_all_internal(sd_device *device, const char *subd
|
|||||||
if (!dir)
|
if (!dir)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, return -errno) {
|
FOREACH_DIRENT_ALL(dent, dir, return -errno) {
|
||||||
_cleanup_free_ char *path = NULL, *p = NULL;
|
_cleanup_free_ char *path = NULL, *p = NULL;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
if (dot_or_dot_dot(de->d_name))
|
if (dot_or_dot_dot(dent->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* only handle symlinks, regular files, and directories */
|
/* only handle symlinks, regular files, and directories */
|
||||||
if (!IN_SET(de->d_type, DT_LNK, DT_REG, DT_DIR))
|
if (!IN_SET(dent->d_type, DT_LNK, DT_REG, DT_DIR))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (subdir) {
|
if (subdir) {
|
||||||
p = path_join(subdir, de->d_name);
|
p = path_join(subdir, dent->d_name);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (de->d_type == DT_DIR) {
|
if (dent->d_type == DT_DIR) {
|
||||||
/* read subdirectory */
|
/* read subdirectory */
|
||||||
r = device_sysattrs_read_all_internal(device, p ?: de->d_name);
|
r = device_sysattrs_read_all_internal(device, p ?: dent->d_name);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = path_join(syspath, p ?: de->d_name);
|
path = path_join(syspath, p ?: dent->d_name);
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -1814,7 +1815,7 @@ static int device_sysattrs_read_all_internal(sd_device *device, const char *subd
|
|||||||
if ((statbuf.st_mode & (S_IRUSR | S_IWUSR)) == 0)
|
if ((statbuf.st_mode & (S_IRUSR | S_IWUSR)) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
r = set_put_strdup(&device->sysattrs, p ?: de->d_name);
|
r = set_put_strdup(&device->sysattrs, p ?: dent->d_name);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -127,6 +127,7 @@ int journal_directory_vacuum(
|
|||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
struct vacuum_info *list = NULL;
|
struct vacuum_info *list = NULL;
|
||||||
usec_t retention_limit = 0;
|
usec_t retention_limit = 0;
|
||||||
|
struct dirent *de;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(directory);
|
assert(directory);
|
||||||
|
|||||||
@ -1560,11 +1560,14 @@ static int directory_open(sd_journal *j, const char *path, DIR **ret) {
|
|||||||
static int add_directory(sd_journal *j, const char *prefix, const char *dirname);
|
static int add_directory(sd_journal *j, const char *prefix, const char *dirname);
|
||||||
|
|
||||||
static void directory_enumerate(sd_journal *j, Directory *m, DIR *d) {
|
static void directory_enumerate(sd_journal *j, Directory *m, DIR *d) {
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
assert(j);
|
assert(j);
|
||||||
assert(m);
|
assert(m);
|
||||||
assert(d);
|
assert(d);
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, d, goto fail) {
|
FOREACH_DIRENT_ALL(de, d, goto fail) {
|
||||||
|
|
||||||
if (dirent_is_journal_file(de))
|
if (dirent_is_journal_file(de))
|
||||||
(void) add_file_by_name(j, m->path, de->d_name);
|
(void) add_file_by_name(j, m->path, de->d_name);
|
||||||
|
|
||||||
@ -1573,6 +1576,7 @@ static void directory_enumerate(sd_journal *j, Directory *m, DIR *d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
log_debug_errno(errno, "Failed to enumerate directory %s, ignoring: %m", m->path);
|
log_debug_errno(errno, "Failed to enumerate directory %s, ignoring: %m", m->path);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -774,6 +774,7 @@ _public_ int sd_get_sessions(char ***sessions) {
|
|||||||
|
|
||||||
_public_ int sd_get_uids(uid_t **users) {
|
_public_ int sd_get_uids(uid_t **users) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
unsigned n = 0;
|
unsigned n = 0;
|
||||||
_cleanup_free_ uid_t *l = NULL;
|
_cleanup_free_ uid_t *l = NULL;
|
||||||
|
|||||||
@ -28,8 +28,13 @@ libudev_basic = static_library(
|
|||||||
'udev-basic',
|
'udev-basic',
|
||||||
libudev_sources,
|
libudev_sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
c_args : ['-fvisibility=default'],
|
c_args : ['-fvisibility=default'])
|
||||||
build_by_default : false)
|
|
||||||
|
libudev_static = static_library(
|
||||||
|
'udev_static',
|
||||||
|
include_directories : includes,
|
||||||
|
link_with : udev_link_with,
|
||||||
|
link_whole : libudev_basic)
|
||||||
|
|
||||||
static_libudev = get_option('static-libudev')
|
static_libudev = get_option('static-libudev')
|
||||||
static_libudev_pic = static_libudev == 'true' or static_libudev == 'pic'
|
static_libudev_pic = static_libudev == 'true' or static_libudev == 'pic'
|
||||||
@ -47,5 +52,5 @@ custom_target(
|
|||||||
tests += [
|
tests += [
|
||||||
[['src/libudev/test-libudev.c'],
|
[['src/libudev/test-libudev.c'],
|
||||||
[libshared,
|
[libshared,
|
||||||
libudev_basic]],
|
libudev_static]],
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1370,7 +1370,9 @@ static int flush_devices(Manager *m) {
|
|||||||
if (!d) {
|
if (!d) {
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
log_warning_errno(errno, "Failed to open /etc/udev/rules.d: %m");
|
log_warning_errno(errno, "Failed to open /etc/udev/rules.d: %m");
|
||||||
} else
|
} else {
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, d, break) {
|
FOREACH_DIRENT_ALL(de, d, break) {
|
||||||
if (!dirent_is_file(de))
|
if (!dirent_is_file(de))
|
||||||
continue;
|
continue;
|
||||||
@ -1384,6 +1386,7 @@ static int flush_devices(Manager *m) {
|
|||||||
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
|
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
|
||||||
log_warning_errno(errno, "Failed to unlink %s: %m", de->d_name);
|
log_warning_errno(errno, "Failed to unlink %s: %m", de->d_name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return trigger_device(m, NULL);
|
return trigger_device(m, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -244,6 +244,7 @@ static int manager_enumerate_buttons(Manager *m) {
|
|||||||
|
|
||||||
static int manager_enumerate_seats(Manager *m) {
|
static int manager_enumerate_seats(Manager *m) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
@ -285,6 +286,7 @@ static int manager_enumerate_seats(Manager *m) {
|
|||||||
|
|
||||||
static int manager_enumerate_linger_users(Manager *m) {
|
static int manager_enumerate_linger_users(Manager *m) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
@ -313,6 +315,7 @@ static int manager_enumerate_linger_users(Manager *m) {
|
|||||||
|
|
||||||
static int manager_enumerate_users(Manager *m) {
|
static int manager_enumerate_users(Manager *m) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r, k;
|
int r, k;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
@ -471,6 +474,7 @@ static int manager_attach_fds(Manager *m) {
|
|||||||
|
|
||||||
static int manager_enumerate_sessions(Manager *m) {
|
static int manager_enumerate_sessions(Manager *m) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r = 0, k;
|
int r = 0, k;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
@ -512,6 +516,7 @@ static int manager_enumerate_sessions(Manager *m) {
|
|||||||
|
|
||||||
static int manager_enumerate_inhibitors(Manager *m) {
|
static int manager_enumerate_inhibitors(Manager *m) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|||||||
@ -50,8 +50,7 @@ liblogind_core = static_library(
|
|||||||
'logind-core',
|
'logind-core',
|
||||||
liblogind_core_sources,
|
liblogind_core_sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
dependencies : libacl,
|
dependencies : [libacl])
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
loginctl_sources = files('''
|
loginctl_sources = files('''
|
||||||
loginctl.c
|
loginctl.c
|
||||||
|
|||||||
@ -136,6 +136,7 @@ static int manager_add_host_machine(Manager *m) {
|
|||||||
|
|
||||||
static int manager_enumerate_machines(Manager *m) {
|
static int manager_enumerate_machines(Manager *m) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|||||||
@ -24,8 +24,7 @@ libmachine_core = static_library(
|
|||||||
'machine-core',
|
'machine-core',
|
||||||
libmachine_core_sources,
|
libmachine_core_sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
dependencies : threads,
|
dependencies : [threads])
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
if conf.get('ENABLE_MACHINED') == 1
|
if conf.get('ENABLE_MACHINED') == 1
|
||||||
install_data('org.freedesktop.machine1.conf',
|
install_data('org.freedesktop.machine1.conf',
|
||||||
|
|||||||
@ -777,6 +777,7 @@ static int find_mount_points(const char *what, char ***list) {
|
|||||||
|
|
||||||
static int find_loop_device(const char *backing_file, char **loop_dev) {
|
static int find_loop_device(const char *backing_file, char **loop_dev) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
_cleanup_free_ char *l = NULL;
|
_cleanup_free_ char *l = NULL;
|
||||||
|
|
||||||
assert(backing_file);
|
assert(backing_file);
|
||||||
|
|||||||
@ -235,8 +235,7 @@ libnetworkd_core = static_library(
|
|||||||
'networkd-core',
|
'networkd-core',
|
||||||
sources,
|
sources,
|
||||||
include_directories : network_includes,
|
include_directories : network_includes,
|
||||||
link_with : networkd_link_with,
|
link_with : [networkd_link_with])
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
if conf.get('ENABLE_NETWORKD') == 1
|
if conf.get('ENABLE_NETWORKD') == 1
|
||||||
install_data('org.freedesktop.network1.conf',
|
install_data('org.freedesktop.network1.conf',
|
||||||
|
|||||||
@ -728,10 +728,6 @@ bool link_address_is_dynamic(const Link *link, const Address *address) {
|
|||||||
if (route->source != NETWORK_CONFIG_SOURCE_FOREIGN)
|
if (route->source != NETWORK_CONFIG_SOURCE_FOREIGN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* The route is not assigned yet, or already removed. Ignoring. */
|
|
||||||
if (!route_exists(route))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (route->protocol != RTPROT_DHCP)
|
if (route->protocol != RTPROT_DHCP)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -844,10 +840,6 @@ int link_drop_foreign_addresses(Link *link) {
|
|||||||
assert(link);
|
assert(link);
|
||||||
assert(link->network);
|
assert(link->network);
|
||||||
|
|
||||||
/* Keep all addresses when KeepConfiguration=yes. */
|
|
||||||
if (link->network->keep_configuration == KEEP_CONFIGURATION_YES)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* First, mark all addresses. */
|
/* First, mark all addresses. */
|
||||||
SET_FOREACH(address, link->addresses) {
|
SET_FOREACH(address, link->addresses) {
|
||||||
/* We consider IPv6LL addresses to be managed by the kernel, or dropped in link_drop_ipv6ll_addresses() */
|
/* We consider IPv6LL addresses to be managed by the kernel, or dropped in link_drop_ipv6ll_addresses() */
|
||||||
@ -862,9 +854,10 @@ int link_drop_foreign_addresses(Link *link) {
|
|||||||
if (!address_exists(address))
|
if (!address_exists(address))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* link_address_is_dynamic() is slightly heavy. Let's call the function only when KeepConfiguration= is set. */
|
if (link_address_is_dynamic(link, address)) {
|
||||||
if (IN_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP, KEEP_CONFIGURATION_STATIC) &&
|
if (link->network && FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP))
|
||||||
link_address_is_dynamic(link, address) == (link->network->keep_configuration == KEEP_CONFIGURATION_DHCP))
|
continue;
|
||||||
|
} else if (link->network && FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_STATIC))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
address_mark(address);
|
address_mark(address);
|
||||||
@ -902,11 +895,8 @@ int link_drop_addresses(Link *link) {
|
|||||||
if (!address_exists(address))
|
if (!address_exists(address))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Do not drop IPv6LL addresses assigned by the kernel here. They will be dropped in
|
/* We consider IPv6LL addresses to be managed by the kernel, or dropped in link_drop_ipv6ll_addresses() */
|
||||||
* link_drop_ipv6ll_addresses() if IPv6LL addressing is disabled. */
|
if (address->family == AF_INET6 && in6_addr_is_link_local(&address->in_addr.in6))
|
||||||
if (address->source == NETWORK_CONFIG_SOURCE_FOREIGN &&
|
|
||||||
address->family == AF_INET6 &&
|
|
||||||
in6_addr_is_link_local(&address->in_addr.in6))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
k = address_remove(address);
|
k = address_remove(address);
|
||||||
|
|||||||
@ -893,7 +893,6 @@ int link_drop_foreign_routes(Link *link) {
|
|||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
assert(link->manager);
|
assert(link->manager);
|
||||||
assert(link->network);
|
|
||||||
|
|
||||||
SET_FOREACH(route, link->routes) {
|
SET_FOREACH(route, link->routes) {
|
||||||
/* do not touch routes managed by the kernel */
|
/* do not touch routes managed by the kernel */
|
||||||
@ -908,11 +907,11 @@ int link_drop_foreign_routes(Link *link) {
|
|||||||
if (!route_exists(route))
|
if (!route_exists(route))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (route->protocol == RTPROT_STATIC &&
|
if (route->protocol == RTPROT_STATIC && link->network &&
|
||||||
FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_STATIC))
|
FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_STATIC))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (route->protocol == RTPROT_DHCP &&
|
if (route->protocol == RTPROT_DHCP && link->network &&
|
||||||
FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP))
|
FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@ -45,8 +45,7 @@ libnspawn_core = static_library(
|
|||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
dependencies : [libacl,
|
dependencies : [libacl,
|
||||||
libseccomp,
|
libseccomp,
|
||||||
libselinux],
|
libselinux])
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
systemd_nspawn_sources = files('nspawn.c')
|
systemd_nspawn_sources = files('nspawn.c')
|
||||||
|
|
||||||
|
|||||||
@ -313,6 +313,8 @@ static int recurse_fd(int fd, bool donate_fd, const struct stat *st, uid_t shift
|
|||||||
goto read_only;
|
goto read_only;
|
||||||
|
|
||||||
if (S_ISDIR(st->st_mode)) {
|
if (S_ISDIR(st->st_mode)) {
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
if (!donate_fd) {
|
if (!donate_fd) {
|
||||||
int copy;
|
int copy;
|
||||||
|
|
||||||
|
|||||||
@ -244,6 +244,7 @@ static int extract_now(
|
|||||||
STRV_FOREACH(i, paths.search_path) {
|
STRV_FOREACH(i, paths.search_path) {
|
||||||
_cleanup_free_ char *resolved = NULL;
|
_cleanup_free_ char *resolved = NULL;
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
r = chase_symlinks_and_opendir(*i, where, 0, &resolved, &d);
|
r = chase_symlinks_and_opendir(*i, where, 0, &resolved, &d);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -1491,6 +1492,7 @@ int portable_detach(
|
|||||||
_cleanup_set_free_ Set *unit_files = NULL, *markers = NULL;
|
_cleanup_set_free_ Set *unit_files = NULL, *markers = NULL;
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
const char *where, *item;
|
const char *where, *item;
|
||||||
|
struct dirent *de;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -1660,6 +1662,7 @@ static int portable_get_state_internal(
|
|||||||
_cleanup_set_free_ Set *unit_files = NULL;
|
_cleanup_set_free_ Set *unit_files = NULL;
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
const char *where;
|
const char *where;
|
||||||
|
struct dirent *de;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(name_or_path);
|
assert(name_or_path);
|
||||||
|
|||||||
@ -323,6 +323,7 @@ static void process_dmesg_files(PStoreList *list) {
|
|||||||
|
|
||||||
static int list_files(PStoreList *list, const char *sourcepath) {
|
static int list_files(PStoreList *list, const char *sourcepath) {
|
||||||
_cleanup_(closedirp) DIR *dirp = NULL;
|
_cleanup_(closedirp) DIR *dirp = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
dirp = opendir(sourcepath);
|
dirp = opendir(sourcepath);
|
||||||
|
|||||||
@ -120,8 +120,7 @@ basic_dns_sources += custom_target(
|
|||||||
libsystemd_resolve_core = static_library(
|
libsystemd_resolve_core = static_library(
|
||||||
'systemd-resolve-core',
|
'systemd-resolve-core',
|
||||||
basic_dns_sources,
|
basic_dns_sources,
|
||||||
include_directories : includes,
|
include_directories : includes)
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
systemd_resolved_sources += custom_target(
|
systemd_resolved_sources += custom_target(
|
||||||
'resolved_gperf.c',
|
'resolved_gperf.c',
|
||||||
|
|||||||
@ -1536,6 +1536,7 @@ void manager_reset_server_features(Manager *m) {
|
|||||||
|
|
||||||
void manager_cleanup_saved_user(Manager *m) {
|
void manager_cleanup_saved_user(Manager *m) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
||||||
|
|||||||
@ -103,6 +103,7 @@ int block_get_originating(dev_t dt, dev_t *ret) {
|
|||||||
_cleanup_free_ char *t = NULL;
|
_cleanup_free_ char *t = NULL;
|
||||||
char p[SYS_BLOCK_PATH_MAX("/slaves")];
|
char p[SYS_BLOCK_PATH_MAX("/slaves")];
|
||||||
_cleanup_free_ char *first_found = NULL;
|
_cleanup_free_ char *first_found = NULL;
|
||||||
|
struct dirent *de;
|
||||||
const char *q;
|
const char *q;
|
||||||
dev_t devt;
|
dev_t devt;
|
||||||
int r;
|
int r;
|
||||||
|
|||||||
@ -488,6 +488,7 @@ static int boot_entries_find_unified(
|
|||||||
size_t *n_entries) {
|
size_t *n_entries) {
|
||||||
|
|
||||||
_cleanup_(closedirp) DIR *d = NULL;
|
_cleanup_(closedirp) DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(root);
|
assert(root);
|
||||||
|
|||||||
@ -52,6 +52,7 @@ static int chown_recursive_internal(
|
|||||||
|
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
struct dirent *de;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(fd >= 0);
|
assert(fd >= 0);
|
||||||
|
|||||||
@ -219,6 +219,7 @@ static int clean_sysvipc_msg(uid_t delete_uid, gid_t delete_gid, bool rm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int clean_posix_shm_internal(const char *dirname, DIR *dir, uid_t uid, gid_t gid, bool rm) {
|
static int clean_posix_shm_internal(const char *dirname, DIR *dir, uid_t uid, gid_t gid, bool rm) {
|
||||||
|
struct dirent *de;
|
||||||
int ret = 0, r;
|
int ret = 0, r;
|
||||||
|
|
||||||
assert(dir);
|
assert(dir);
|
||||||
@ -314,6 +315,7 @@ static int clean_posix_shm(uid_t uid, gid_t gid, bool rm) {
|
|||||||
|
|
||||||
static int clean_posix_mq(uid_t uid, gid_t gid, bool rm) {
|
static int clean_posix_mq(uid_t uid, gid_t gid, bool rm) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
dir = opendir("/dev/mqueue");
|
dir = opendir("/dev/mqueue");
|
||||||
|
|||||||
@ -789,6 +789,7 @@ static int fd_copy_directory(
|
|||||||
|
|
||||||
_cleanup_close_ int fdf = -1, fdt = -1;
|
_cleanup_close_ int fdf = -1, fdt = -1;
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
bool exists, created;
|
bool exists, created;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|||||||
@ -166,6 +166,7 @@ int devnode_acl_all(const char *seat,
|
|||||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
||||||
_cleanup_set_free_free_ Set *nodes = NULL;
|
_cleanup_set_free_free_ Set *nodes = NULL;
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *dent;
|
||||||
sd_device *d;
|
sd_device *d;
|
||||||
char *n;
|
char *n;
|
||||||
int r;
|
int r;
|
||||||
@ -217,11 +218,11 @@ int devnode_acl_all(const char *seat,
|
|||||||
* these devices are not known to the kernel at this moment */
|
* these devices are not known to the kernel at this moment */
|
||||||
dir = opendir("/run/udev/static_node-tags/uaccess");
|
dir = opendir("/run/udev/static_node-tags/uaccess");
|
||||||
if (dir) {
|
if (dir) {
|
||||||
FOREACH_DIRENT(de, dir, return -errno) {
|
FOREACH_DIRENT(dent, dir, return -errno) {
|
||||||
_cleanup_free_ char *unescaped_devname = NULL;
|
_cleanup_free_ char *unescaped_devname = NULL;
|
||||||
ssize_t l;
|
ssize_t l;
|
||||||
|
|
||||||
l = cunescape(de->d_name, UNESCAPE_RELAX, &unescaped_devname);
|
l = cunescape(dent->d_name, UNESCAPE_RELAX, &unescaped_devname);
|
||||||
if (l < 0)
|
if (l < 0)
|
||||||
return l;
|
return l;
|
||||||
|
|
||||||
|
|||||||
@ -543,6 +543,7 @@ int image_discover(
|
|||||||
NULSTR_FOREACH(path, image_search_path[class]) {
|
NULSTR_FOREACH(path, image_search_path[class]) {
|
||||||
_cleanup_free_ char *resolved = NULL;
|
_cleanup_free_ char *resolved = NULL;
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
r = chase_symlinks_and_opendir(path, root, CHASE_PREFIX_ROOT, &resolved, &d);
|
r = chase_symlinks_and_opendir(path, root, CHASE_PREFIX_ROOT, &resolved, &d);
|
||||||
if (r == -ENOENT)
|
if (r == -ENOENT)
|
||||||
|
|||||||
@ -485,6 +485,7 @@ static int cmp_uint16(const uint16_t *a, const uint16_t *b) {
|
|||||||
int efi_get_boot_options(uint16_t **options) {
|
int efi_get_boot_options(uint16_t **options) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
_cleanup_free_ uint16_t *list = NULL;
|
_cleanup_free_ uint16_t *list = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
assert(options);
|
assert(options);
|
||||||
|
|||||||
@ -112,6 +112,7 @@ int fdset_remove(FDSet *s, int fd) {
|
|||||||
|
|
||||||
int fdset_new_fill(FDSet **_s) {
|
int fdset_new_fill(FDSet **_s) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
FDSet *s;
|
FDSet *s;
|
||||||
|
|
||||||
|
|||||||
@ -549,6 +549,7 @@ static int remove_marked_symlinks_fd(
|
|||||||
size_t *n_changes) {
|
size_t *n_changes) {
|
||||||
|
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert(remove_symlinks_to);
|
assert(remove_symlinks_to);
|
||||||
@ -728,6 +729,7 @@ static int find_symlinks_in_directory(
|
|||||||
const char *config_path,
|
const char *config_path,
|
||||||
bool *same_name_link) {
|
bool *same_name_link) {
|
||||||
|
|
||||||
|
struct dirent *de;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
FOREACH_DIRENT(de, dir, return -errno) {
|
FOREACH_DIRENT(de, dir, return -errno) {
|
||||||
@ -812,6 +814,7 @@ static int find_symlinks(
|
|||||||
bool *same_name_link) {
|
bool *same_name_link) {
|
||||||
|
|
||||||
_cleanup_closedir_ DIR *config_dir = NULL;
|
_cleanup_closedir_ DIR *config_dir = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert(i);
|
assert(i);
|
||||||
@ -3366,6 +3369,7 @@ int unit_file_preset_all(
|
|||||||
|
|
||||||
STRV_FOREACH(i, paths.search_path) {
|
STRV_FOREACH(i, paths.search_path) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
d = opendir(*i);
|
d = opendir(*i);
|
||||||
if (!d) {
|
if (!d) {
|
||||||
@ -3430,6 +3434,7 @@ int unit_file_get_list(
|
|||||||
|
|
||||||
STRV_FOREACH(dirname, paths.search_path) {
|
STRV_FOREACH(dirname, paths.search_path) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
d = opendir(*dirname);
|
d = opendir(*dirname);
|
||||||
if (!d) {
|
if (!d) {
|
||||||
|
|||||||
@ -188,6 +188,7 @@ static int wait_for_children(Set *pids, sigset_t *mask, usec_t timeout) {
|
|||||||
|
|
||||||
static int killall(int sig, Set *pids, bool send_sighup) {
|
static int killall(int sig, Set *pids, bool send_sighup) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *d;
|
||||||
int n_killed = 0;
|
int n_killed = 0;
|
||||||
|
|
||||||
/* Send the specified signal to all remaining processes, if not excluded by ignore_proc().
|
/* Send the specified signal to all remaining processes, if not excluded by ignore_proc().
|
||||||
@ -197,14 +198,14 @@ static int killall(int sig, Set *pids, bool send_sighup) {
|
|||||||
if (!dir)
|
if (!dir)
|
||||||
return log_warning_errno(errno, "opendir(/proc) failed: %m");
|
return log_warning_errno(errno, "opendir(/proc) failed: %m");
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, break) {
|
FOREACH_DIRENT_ALL(d, dir, break) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!IN_SET(de->d_type, DT_DIR, DT_UNKNOWN))
|
if (!IN_SET(d->d_type, DT_DIR, DT_UNKNOWN))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (parse_pid(de->d_name, &pid) < 0)
|
if (parse_pid(d->d_name, &pid) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ignore_proc(pid, sig == SIGKILL && !in_initrd()))
|
if (ignore_proc(pid, sig == SIGKILL && !in_initrd()))
|
||||||
|
|||||||
@ -459,8 +459,7 @@ libshared_static = static_library(
|
|||||||
shared_sources,
|
shared_sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
dependencies : libshared_deps,
|
dependencies : libshared_deps,
|
||||||
c_args : ['-fvisibility=default'],
|
c_args : ['-fvisibility=default'])
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
libshared = shared_library(
|
libshared = shared_library(
|
||||||
libshared_name,
|
libshared_name,
|
||||||
|
|||||||
@ -128,6 +128,7 @@ int numa_to_cpu_set(const NUMAPolicy *policy, CPUSet *ret) {
|
|||||||
|
|
||||||
static int numa_max_node(void) {
|
static int numa_max_node(void) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r, max_node = 0;
|
int r, max_node = 0;
|
||||||
|
|
||||||
d = opendir("/sys/devices/system/node");
|
d = opendir("/sys/devices/system/node");
|
||||||
|
|||||||
@ -203,6 +203,7 @@ int rm_rf_children(
|
|||||||
const struct stat *root_dev) {
|
const struct stat *root_dev) {
|
||||||
|
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int ret = 0, r;
|
int ret = 0, r;
|
||||||
|
|
||||||
assert(fd >= 0);
|
assert(fd >= 0);
|
||||||
|
|||||||
@ -405,6 +405,7 @@ static int userdb_start_query(
|
|||||||
|
|
||||||
_cleanup_(strv_freep) char **except = NULL, **only = NULL;
|
_cleanup_(strv_freep) char **except = NULL, **only = NULL;
|
||||||
_cleanup_(closedirp) DIR *d = NULL;
|
_cleanup_(closedirp) DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
const char *e;
|
const char *e;
|
||||||
int r, ret = 0;
|
int r, ret = 0;
|
||||||
|
|
||||||
|
|||||||
@ -718,6 +718,7 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
|
|||||||
|
|
||||||
STRV_FOREACH(path, sysvinit_path) {
|
STRV_FOREACH(path, sysvinit_path) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
d = opendir(*path);
|
d = opendir(*path);
|
||||||
if (!d) {
|
if (!d) {
|
||||||
@ -804,6 +805,7 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic
|
|||||||
for (unsigned i = 0; i < ELEMENTSOF(rcnd_table); i ++) {
|
for (unsigned i = 0; i < ELEMENTSOF(rcnd_table); i ++) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
_cleanup_free_ char *path = NULL;
|
_cleanup_free_ char *path = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
path = path_join(*p, rcnd_table[i].path);
|
path = path_join(*p, rcnd_table[i].path);
|
||||||
if (!path) {
|
if (!path) {
|
||||||
|
|||||||
@ -167,6 +167,7 @@ TEST(get_paths, .sd_booted = true) {
|
|||||||
|
|
||||||
TEST(proc) {
|
TEST(proc) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
d = opendir("/proc");
|
d = opendir("/proc");
|
||||||
|
|||||||
@ -135,6 +135,7 @@ static void test_get_process_cmdline_one(pid_t pid) {
|
|||||||
|
|
||||||
TEST(get_process_cmdline) {
|
TEST(get_process_cmdline) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
assert_se(d = opendir("/proc"));
|
assert_se(d = opendir("/proc"));
|
||||||
|
|
||||||
|
|||||||
@ -32,8 +32,7 @@ libtimesyncd_core = static_library(
|
|||||||
'timesyncd-core',
|
'timesyncd-core',
|
||||||
sources,
|
sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
link_with : timesyncd_link_with,
|
link_with : [timesyncd_link_with])
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
custom_target(
|
custom_target(
|
||||||
'timesyncd.conf',
|
'timesyncd.conf',
|
||||||
|
|||||||
@ -590,13 +590,14 @@ static int dir_cleanup(
|
|||||||
AgeBy age_by_dir) {
|
AgeBy age_by_dir) {
|
||||||
|
|
||||||
bool deleted = false;
|
bool deleted = false;
|
||||||
|
struct dirent *dent;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, d, break) {
|
FOREACH_DIRENT_ALL(dent, d, break) {
|
||||||
_cleanup_free_ char *sub_path = NULL;
|
_cleanup_free_ char *sub_path = NULL;
|
||||||
nsec_t atime_nsec, mtime_nsec, ctime_nsec, btime_nsec;
|
nsec_t atime_nsec, mtime_nsec, ctime_nsec, btime_nsec;
|
||||||
|
|
||||||
if (dot_or_dot_dot(de->d_name))
|
if (dot_or_dot_dot(dent->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* If statx() is supported, use it. It's preferable over fstatat() since it tells us
|
/* If statx() is supported, use it. It's preferable over fstatat() since it tells us
|
||||||
@ -613,7 +614,7 @@ static int dir_cleanup(
|
|||||||
STRUCT_STATX_DEFINE(sx);
|
STRUCT_STATX_DEFINE(sx);
|
||||||
|
|
||||||
r = statx_fallback(
|
r = statx_fallback(
|
||||||
dirfd(d), de->d_name,
|
dirfd(d), dent->d_name,
|
||||||
AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT,
|
AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT,
|
||||||
STATX_TYPE|STATX_MODE|STATX_UID|STATX_ATIME|STATX_MTIME|STATX_CTIME|STATX_BTIME,
|
STATX_TYPE|STATX_MODE|STATX_UID|STATX_ATIME|STATX_MTIME|STATX_CTIME|STATX_BTIME,
|
||||||
&sx);
|
&sx);
|
||||||
@ -622,14 +623,14 @@ static int dir_cleanup(
|
|||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
/* FUSE, NFS mounts, SELinux might return EACCES */
|
/* FUSE, NFS mounts, SELinux might return EACCES */
|
||||||
r = log_full_errno(errno == EACCES ? LOG_DEBUG : LOG_ERR, errno,
|
r = log_full_errno(errno == EACCES ? LOG_DEBUG : LOG_ERR, errno,
|
||||||
"statx(%s/%s) failed: %m", p, de->d_name);
|
"statx(%s/%s) failed: %m", p, dent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FLAGS_SET(sx.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT)) {
|
if (FLAGS_SET(sx.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT)) {
|
||||||
/* Yay, we have the mount point API, use it */
|
/* Yay, we have the mount point API, use it */
|
||||||
if (FLAGS_SET(sx.stx_attributes, STATX_ATTR_MOUNT_ROOT)) {
|
if (FLAGS_SET(sx.stx_attributes, STATX_ATTR_MOUNT_ROOT)) {
|
||||||
log_debug("Ignoring \"%s/%s\": different mount points.", p, de->d_name);
|
log_debug("Ignoring \"%s/%s\": different mount points.", p, dent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -637,7 +638,7 @@ static int dir_cleanup(
|
|||||||
* back to traditional stx_dev checking. */
|
* back to traditional stx_dev checking. */
|
||||||
if (sx.stx_dev_major != rootdev_major ||
|
if (sx.stx_dev_major != rootdev_major ||
|
||||||
sx.stx_dev_minor != rootdev_minor) {
|
sx.stx_dev_minor != rootdev_minor) {
|
||||||
log_debug("Ignoring \"%s/%s\": different filesystem.", p, de->d_name);
|
log_debug("Ignoring \"%s/%s\": different filesystem.", p, dent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,11 +648,11 @@ static int dir_cleanup(
|
|||||||
if (S_ISDIR(sx.stx_mode)) {
|
if (S_ISDIR(sx.stx_mode)) {
|
||||||
int q;
|
int q;
|
||||||
|
|
||||||
q = fd_is_mount_point(dirfd(d), de->d_name, 0);
|
q = fd_is_mount_point(dirfd(d), dent->d_name, 0);
|
||||||
if (q < 0)
|
if (q < 0)
|
||||||
log_debug_errno(q, "Failed to determine whether \"%s/%s\" is a mount point, ignoring: %m", p, de->d_name);
|
log_debug_errno(q, "Failed to determine whether \"%s/%s\" is a mount point, ignoring: %m", p, dent->d_name);
|
||||||
else if (q > 0) {
|
else if (q > 0) {
|
||||||
log_debug("Ignoring \"%s/%s\": different mount of the same filesystem.", p, de->d_name);
|
log_debug("Ignoring \"%s/%s\": different mount of the same filesystem.", p, dent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -662,7 +663,7 @@ static int dir_cleanup(
|
|||||||
ctime_nsec = FLAGS_SET(sx.stx_mask, STATX_CTIME) ? load_statx_timestamp_nsec(&sx.stx_ctime) : 0;
|
ctime_nsec = FLAGS_SET(sx.stx_mask, STATX_CTIME) ? load_statx_timestamp_nsec(&sx.stx_ctime) : 0;
|
||||||
btime_nsec = FLAGS_SET(sx.stx_mask, STATX_BTIME) ? load_statx_timestamp_nsec(&sx.stx_btime) : 0;
|
btime_nsec = FLAGS_SET(sx.stx_mask, STATX_BTIME) ? load_statx_timestamp_nsec(&sx.stx_btime) : 0;
|
||||||
|
|
||||||
sub_path = path_join(p, de->d_name);
|
sub_path = path_join(p, dent->d_name);
|
||||||
if (!sub_path) {
|
if (!sub_path) {
|
||||||
r = log_oom();
|
r = log_oom();
|
||||||
goto finish;
|
goto finish;
|
||||||
@ -683,7 +684,7 @@ static int dir_cleanup(
|
|||||||
_cleanup_closedir_ DIR *sub_dir = NULL;
|
_cleanup_closedir_ DIR *sub_dir = NULL;
|
||||||
|
|
||||||
if (mountpoint &&
|
if (mountpoint &&
|
||||||
streq(de->d_name, "lost+found") &&
|
streq(dent->d_name, "lost+found") &&
|
||||||
sx.stx_uid == 0) {
|
sx.stx_uid == 0) {
|
||||||
log_debug("Ignoring directory \"%s\".", sub_path);
|
log_debug("Ignoring directory \"%s\".", sub_path);
|
||||||
continue;
|
continue;
|
||||||
@ -694,7 +695,7 @@ static int dir_cleanup(
|
|||||||
else {
|
else {
|
||||||
int q;
|
int q;
|
||||||
|
|
||||||
sub_dir = xopendirat_nomod(dirfd(d), de->d_name);
|
sub_dir = xopendirat_nomod(dirfd(d), dent->d_name);
|
||||||
if (!sub_dir) {
|
if (!sub_dir) {
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
r = log_warning_errno(errno, "Opening directory \"%s\" failed, ignoring: %m", sub_path);
|
r = log_warning_errno(errno, "Opening directory \"%s\" failed, ignoring: %m", sub_path);
|
||||||
@ -736,7 +737,7 @@ static int dir_cleanup(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
log_debug("Removing directory \"%s\".", sub_path);
|
log_debug("Removing directory \"%s\".", sub_path);
|
||||||
if (unlinkat(dirfd(d), de->d_name, AT_REMOVEDIR) < 0)
|
if (unlinkat(dirfd(d), dent->d_name, AT_REMOVEDIR) < 0)
|
||||||
if (!IN_SET(errno, ENOENT, ENOTEMPTY))
|
if (!IN_SET(errno, ENOENT, ENOTEMPTY))
|
||||||
r = log_warning_errno(errno, "Failed to remove directory \"%s\", ignoring: %m", sub_path);
|
r = log_warning_errno(errno, "Failed to remove directory \"%s\", ignoring: %m", sub_path);
|
||||||
|
|
||||||
@ -751,7 +752,7 @@ static int dir_cleanup(
|
|||||||
if (mountpoint &&
|
if (mountpoint &&
|
||||||
S_ISREG(sx.stx_mode) &&
|
S_ISREG(sx.stx_mode) &&
|
||||||
sx.stx_uid == 0 &&
|
sx.stx_uid == 0 &&
|
||||||
STR_IN_SET(de->d_name,
|
STR_IN_SET(dent->d_name,
|
||||||
".journal",
|
".journal",
|
||||||
"aquota.user",
|
"aquota.user",
|
||||||
"aquota.group")) {
|
"aquota.group")) {
|
||||||
@ -782,7 +783,7 @@ static int dir_cleanup(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
log_debug("Removing \"%s\".", sub_path);
|
log_debug("Removing \"%s\".", sub_path);
|
||||||
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
|
if (unlinkat(dirfd(d), dent->d_name, 0) < 0)
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
r = log_warning_errno(errno, "Failed to remove \"%s\", ignoring: %m", sub_path);
|
r = log_warning_errno(errno, "Failed to remove \"%s\", ignoring: %m", sub_path);
|
||||||
|
|
||||||
@ -1919,6 +1920,7 @@ static int item_do(Item *i, int fd, const char *path, fdaction_t action) {
|
|||||||
|
|
||||||
if (S_ISDIR(st.st_mode)) {
|
if (S_ISDIR(st.st_mode)) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
/* The passed 'fd' was opened with O_PATH. We need to convert it into a 'regular' fd before
|
/* The passed 'fd' was opened with O_PATH. We need to convert it into a 'regular' fd before
|
||||||
* reading the directory content. */
|
* reading the directory content. */
|
||||||
|
|||||||
@ -295,6 +295,7 @@ static int wall_tty_block(void) {
|
|||||||
|
|
||||||
static int process_password_files(void) {
|
static int process_password_files(void) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
d = opendir("/run/systemd/ask-password");
|
d = opendir("/run/systemd/ask-password");
|
||||||
|
|||||||
@ -115,9 +115,7 @@ libudevd_core = static_library(
|
|||||||
keyboard_keys_from_name_h,
|
keyboard_keys_from_name_h,
|
||||||
include_directories : udev_includes,
|
include_directories : udev_includes,
|
||||||
link_with : udev_link_with,
|
link_with : udev_link_with,
|
||||||
dependencies : [libblkid,
|
dependencies : [libblkid, libkmod])
|
||||||
libkmod],
|
|
||||||
build_by_default : false)
|
|
||||||
|
|
||||||
udev_progs = [['ata_id/ata_id.c'],
|
udev_progs = [['ata_id/ata_id.c'],
|
||||||
['cdrom_id/cdrom_id.c'],
|
['cdrom_id/cdrom_id.c'],
|
||||||
|
|||||||
@ -97,6 +97,7 @@ static int get_virtfn_info(sd_device *pcidev, sd_device **ret_physfn_pcidev, cha
|
|||||||
_cleanup_(sd_device_unrefp) sd_device *physfn_pcidev = NULL;
|
_cleanup_(sd_device_unrefp) sd_device *physfn_pcidev = NULL;
|
||||||
const char *physfn_syspath, *syspath;
|
const char *physfn_syspath, *syspath;
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *dent;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(pcidev);
|
assert(pcidev);
|
||||||
@ -122,15 +123,15 @@ static int get_virtfn_info(sd_device *pcidev, sd_device **ret_physfn_pcidev, cha
|
|||||||
if (!dir)
|
if (!dir)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, break) {
|
FOREACH_DIRENT_ALL(dent, dir, break) {
|
||||||
_cleanup_free_ char *virtfn_link_file = NULL, *virtfn_pci_syspath = NULL;
|
_cleanup_free_ char *virtfn_link_file = NULL, *virtfn_pci_syspath = NULL;
|
||||||
const char *n;
|
const char *n;
|
||||||
|
|
||||||
n = startswith(de->d_name, "virtfn");
|
n = startswith(dent->d_name, "virtfn");
|
||||||
if (!n)
|
if (!n)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
virtfn_link_file = path_join(physfn_syspath, de->d_name);
|
virtfn_link_file = path_join(physfn_syspath, dent->d_name);
|
||||||
if (!virtfn_link_file)
|
if (!virtfn_link_file)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -389,6 +390,8 @@ static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) {
|
|||||||
|
|
||||||
hotplug_slot_dev = names->pcidev;
|
hotplug_slot_dev = names->pcidev;
|
||||||
while (hotplug_slot_dev) {
|
while (hotplug_slot_dev) {
|
||||||
|
struct dirent *dent;
|
||||||
|
|
||||||
r = parse_hotplug_slot_from_function_id(hotplug_slot_dev, slots, &hotplug_slot);
|
r = parse_hotplug_slot_from_function_id(hotplug_slot_dev, slots, &hotplug_slot);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return 0;
|
return 0;
|
||||||
@ -401,20 +404,20 @@ static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_device_debug_errno(hotplug_slot_dev, r, "Failed to get sysname: %m");
|
return log_device_debug_errno(hotplug_slot_dev, r, "Failed to get sysname: %m");
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, break) {
|
FOREACH_DIRENT_ALL(dent, dir, break) {
|
||||||
_cleanup_free_ char *address = NULL;
|
_cleanup_free_ char *address = NULL;
|
||||||
char str[PATH_MAX];
|
char str[PATH_MAX];
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
if (dot_or_dot_dot(de->d_name))
|
if (dot_or_dot_dot(dent->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
r = safe_atou32(de->d_name, &i);
|
r = safe_atou32(dent->d_name, &i);
|
||||||
if (r < 0 || i <= 0)
|
if (r < 0 || i <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* match slot address with device by stripping the function */
|
/* match slot address with device by stripping the function */
|
||||||
if (snprintf_ok(str, sizeof str, "%s/%s/address", slots, de->d_name) &&
|
if (snprintf_ok(str, sizeof str, "%s/%s/address", slots, dent->d_name) &&
|
||||||
read_one_line_file(str, &address) >= 0 &&
|
read_one_line_file(str, &address) >= 0 &&
|
||||||
startswith(sysname, address)) {
|
startswith(sysname, address)) {
|
||||||
hotplug_slot = i;
|
hotplug_slot = i;
|
||||||
|
|||||||
@ -309,6 +309,7 @@ static sd_device *handle_scsi_default(sd_device *parent, char **path) {
|
|||||||
int host, bus, target, lun;
|
int host, bus, target, lun;
|
||||||
const char *name, *base, *pos;
|
const char *name, *base, *pos;
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *dent;
|
||||||
int basenum = -1;
|
int basenum = -1;
|
||||||
|
|
||||||
assert(parent);
|
assert(parent);
|
||||||
@ -351,16 +352,16 @@ static sd_device *handle_scsi_default(sd_device *parent, char **path) {
|
|||||||
if (!dir)
|
if (!dir)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, break) {
|
FOREACH_DIRENT_ALL(dent, dir, break) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
if (de->d_name[0] == '.')
|
if (dent->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
if (!IN_SET(de->d_type, DT_DIR, DT_LNK))
|
if (!IN_SET(dent->d_type, DT_DIR, DT_LNK))
|
||||||
continue;
|
continue;
|
||||||
if (!startswith(de->d_name, "host"))
|
if (!startswith(dent->d_name, "host"))
|
||||||
continue;
|
continue;
|
||||||
if (safe_atou_full(&de->d_name[4], 10, &i) < 0)
|
if (safe_atou_full(&dent->d_name[4], 10, &i) < 0)
|
||||||
continue;
|
continue;
|
||||||
/*
|
/*
|
||||||
* find the smallest number; the host really needs to export its
|
* find the smallest number; the host really needs to export its
|
||||||
|
|||||||
@ -111,6 +111,7 @@ static int node_symlink(sd_device *dev, const char *node, const char *slink) {
|
|||||||
static int link_find_prioritized(sd_device *dev, bool add, const char *stackdir, char **ret) {
|
static int link_find_prioritized(sd_device *dev, bool add, const char *stackdir, char **ret) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
_cleanup_free_ char *target = NULL;
|
_cleanup_free_ char *target = NULL;
|
||||||
|
struct dirent *dent;
|
||||||
int r, priority = 0;
|
int r, priority = 0;
|
||||||
const char *id;
|
const char *id;
|
||||||
|
|
||||||
@ -152,18 +153,18 @@ static int link_find_prioritized(sd_device *dev, bool add, const char *stackdir,
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, break) {
|
FOREACH_DIRENT_ALL(dent, dir, break) {
|
||||||
_cleanup_free_ char *path = NULL, *buf = NULL;
|
_cleanup_free_ char *path = NULL, *buf = NULL;
|
||||||
int tmp_prio;
|
int tmp_prio;
|
||||||
|
|
||||||
if (de->d_name[0] == '.')
|
if (dent->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* skip ourself */
|
/* skip ourself */
|
||||||
if (streq(de->d_name, id))
|
if (streq(dent->d_name, id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
path = path_join(stackdir, de->d_name);
|
path = path_join(stackdir, dent->d_name);
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -196,7 +197,7 @@ static int link_find_prioritized(sd_device *dev, bool add, const char *stackdir,
|
|||||||
/* Old format. The devnode and priority must be obtained from uevent and
|
/* Old format. The devnode and priority must be obtained from uevent and
|
||||||
* udev database files. */
|
* udev database files. */
|
||||||
|
|
||||||
if (sd_device_new_from_device_id(&tmp_dev, de->d_name) < 0)
|
if (sd_device_new_from_device_id(&tmp_dev, dent->d_name) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (device_get_devlink_priority(tmp_dev, &tmp_prio) < 0)
|
if (device_get_devlink_priority(tmp_dev, &tmp_prio) < 0)
|
||||||
|
|||||||
@ -1494,6 +1494,7 @@ static int import_parent_into_properties(sd_device *dev, const char *filter) {
|
|||||||
|
|
||||||
static int attr_subst_subdir(char attr[static UDEV_PATH_SIZE]) {
|
static int attr_subst_subdir(char attr[static UDEV_PATH_SIZE]) {
|
||||||
_cleanup_closedir_ DIR *dir = NULL;
|
_cleanup_closedir_ DIR *dir = NULL;
|
||||||
|
struct dirent *dent;
|
||||||
char buf[UDEV_PATH_SIZE], *p;
|
char buf[UDEV_PATH_SIZE], *p;
|
||||||
const char *tail;
|
const char *tail;
|
||||||
size_t len, size;
|
size_t len, size;
|
||||||
@ -1515,11 +1516,11 @@ static int attr_subst_subdir(char attr[static UDEV_PATH_SIZE]) {
|
|||||||
if (!dir)
|
if (!dir)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
FOREACH_DIRENT_ALL(de, dir, break) {
|
FOREACH_DIRENT_ALL(dent, dir, break) {
|
||||||
if (de->d_name[0] == '.')
|
if (dent->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
strscpyl(p, size, de->d_name, tail, NULL);
|
strscpyl(p, size, dent->d_name, tail, NULL);
|
||||||
if (faccessat(dirfd(dir), p, F_OK, 0) < 0)
|
if (faccessat(dirfd(dir), p, F_OK, 0) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
#define MIN_RANDOM_DELAY ( 10 * USEC_PER_MSEC)
|
#define MIN_RANDOM_DELAY ( 10 * USEC_PER_MSEC)
|
||||||
|
|
||||||
int udev_watch_restore(int inotify_fd) {
|
int udev_watch_restore(int inotify_fd) {
|
||||||
|
struct dirent *ent;
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|||||||
@ -229,6 +229,8 @@ static int export_devices(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void cleanup_dir(DIR *dir, mode_t mask, int depth) {
|
static void cleanup_dir(DIR *dir, mode_t mask, int depth) {
|
||||||
|
struct dirent *dent;
|
||||||
|
|
||||||
if (depth <= 0)
|
if (depth <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@ -518,6 +518,7 @@ static int display_memberships(int argc, char *argv[], void *userdata) {
|
|||||||
static int display_services(int argc, char *argv[], void *userdata) {
|
static int display_services(int argc, char *argv[], void *userdata) {
|
||||||
_cleanup_(table_unrefp) Table *t = NULL;
|
_cleanup_(table_unrefp) Table *t = NULL;
|
||||||
_cleanup_(closedirp) DIR *d = NULL;
|
_cleanup_(closedirp) DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
d = opendir("/run/systemd/userdb/");
|
d = opendir("/run/systemd/userdb/");
|
||||||
|
|||||||
@ -43,6 +43,7 @@ static int enumerate_xdg_autostart(Hashmap *all_services) {
|
|||||||
|
|
||||||
STRV_FOREACH(path, autostart_dirs) {
|
STRV_FOREACH(path, autostart_dirs) {
|
||||||
_cleanup_closedir_ DIR *d = NULL;
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
|
||||||
d = opendir(*path);
|
d = opendir(*path);
|
||||||
if (!d) {
|
if (!d) {
|
||||||
|
|||||||
@ -4588,11 +4588,12 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, r'192.168.5.*')
|
self.assertRegex(output, r'192.168.5.*')
|
||||||
|
|
||||||
with open(os.path.join(network_unit_file_path, 'dhcp-client-keep-configuration-dhcp.network'), mode='a') as f:
|
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||||
f.write('[Network]\nDHCP=no\n')
|
print(output)
|
||||||
|
self.assertRegex(output, r'192.168.5.*')
|
||||||
|
|
||||||
start_networkd()
|
start_networkd(3)
|
||||||
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
self.wait_online(['veth-peer:routable'])
|
||||||
|
|
||||||
print('Still the lease address should be kept after networkd restarted')
|
print('Still the lease address should be kept after networkd restarted')
|
||||||
output = check_output('ip address show dev veth99 scope global')
|
output = check_output('ip address show dev veth99 scope global')
|
||||||
|
|||||||
@ -5,7 +5,7 @@ set -o pipefail
|
|||||||
|
|
||||||
# Check if homectl is installed, and if it isn't bail out early instead of failing
|
# Check if homectl is installed, and if it isn't bail out early instead of failing
|
||||||
if ! test -x /usr/bin/homectl ; then
|
if ! test -x /usr/bin/homectl ; then
|
||||||
echo "no homed" >/skipped
|
echo OK >/testok
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -128,13 +128,6 @@ signature_size="$((signature_size * 2))KiB"
|
|||||||
|
|
||||||
HAVE_OPENSSL=0
|
HAVE_OPENSSL=0
|
||||||
if systemctl --version | grep -q -- +OPENSSL ; then
|
if systemctl --version | grep -q -- +OPENSSL ; then
|
||||||
# The openssl binary is installed conditionally.
|
|
||||||
# If we have OpenSSL support enabled and openssl is missing, fail early
|
|
||||||
# with a proper error message.
|
|
||||||
if ! command -v openssl >/dev/null 2>&1; then
|
|
||||||
echo "openssl missing" >/failed
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
HAVE_OPENSSL=1
|
HAVE_OPENSSL=1
|
||||||
# Unfortunately OpenSSL insists on reading some config file, hence provide one with mostly placeholder contents
|
# Unfortunately OpenSSL insists on reading some config file, hence provide one with mostly placeholder contents
|
||||||
cat >> "${image}.openssl.cnf" <<EOF
|
cat >> "${image}.openssl.cnf" <<EOF
|
||||||
|
|||||||
@ -56,10 +56,6 @@ WantedBy=multi-user.target
|
|||||||
Also=systemd-networkd.socket
|
Also=systemd-networkd.socket
|
||||||
Alias=dbus-org.freedesktop.network1.service
|
Alias=dbus-org.freedesktop.network1.service
|
||||||
|
|
||||||
# The output from this generator is used by udevd and networkd. Enable it by
|
|
||||||
# default when enabling systemd-networkd.service.
|
|
||||||
Also=systemd-network-generator.service
|
|
||||||
|
|
||||||
# We want to enable systemd-networkd-wait-online.service whenever this service
|
# We want to enable systemd-networkd-wait-online.service whenever this service
|
||||||
# is enabled. systemd-networkd-wait-online.service has
|
# is enabled. systemd-networkd-wait-online.service has
|
||||||
# WantedBy=network-online.target, so enabling it only has an effect if
|
# WantedBy=network-online.target, so enabling it only has an effect if
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user