1
0
mirror of https://github.com/systemd/systemd synced 2025-09-30 09:14:46 +02:00

Compare commits

..

No commits in common. "5623600c6e65c3be9cfebd5cd5235b30cf5d521b" and "2ef2376d833dca05ab32bba41fcf5c345b25916e" have entirely different histories.

31 changed files with 88 additions and 339 deletions

View File

@ -115,7 +115,6 @@ node /org/freedesktop/resolve1 {
ResetStatistics();
FlushCaches();
ResetServerFeatures();
GetMulticastHosts(out a(stiiay) UNNAMED);
properties:
readonly s LLMNRHostname = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
@ -165,8 +164,6 @@ node /org/freedesktop/resolve1 {
<!--method ResetServerFeatures is not documented!-->
<!--method GetMulticastHosts is not documented!-->
<!--property DNSSECNegativeTrustAnchors is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
@ -215,8 +212,6 @@ node /org/freedesktop/resolve1 {
<variablelist class="dbus-method" generated="True" extra-ref="ResetServerFeatures()"/>
<variablelist class="dbus-method" generated="True" extra-ref="GetMulticastHosts()"/>
<variablelist class="dbus-property" generated="True" extra-ref="LLMNRHostname"/>
<variablelist class="dbus-property" generated="True" extra-ref="LLMNR"/>

View File

@ -180,13 +180,6 @@
automatically, an explicit reverting is not necessary in that case.</para></listitem>
</varlistentry>
<varlistentry>
<term><command>show-multicast</command></term>
<listitem><para>Display the discovered LLMNR and mDNS hostnames along with their IPv4/IPv6 addresses.
</para></listitem>
</varlistentry>
<xi:include href="systemctl.xml" xpointer="log-level" />
</variablelist>
</refsect1>

View File

@ -1,5 +0,0 @@
#!/bin/sh
set -e
mkdir -p /root/build
echo "directory /root/build" > ~/.gdbinit

View File

@ -391,10 +391,9 @@ static int fd_copy_symlink(
uid_is_valid(override_uid) ? override_uid : st->st_uid,
gid_is_valid(override_gid) ? override_gid : st->st_gid,
AT_SYMLINK_NOFOLLOW) < 0)
r = -errno;
return -errno;
(void) utimensat(dt, to, (struct timespec[]) { st->st_atim, st->st_mtim }, AT_SYMLINK_NOFOLLOW);
return r;
return 0;
}
/* Encapsulates the database we store potential hardlink targets in */
@ -593,6 +592,7 @@ static int fd_copy_regular(
void *userdata) {
_cleanup_close_ int fdf = -1, fdt = -1;
struct timespec ts[2];
int r, q;
assert(from);
@ -634,7 +634,9 @@ static int fd_copy_regular(
if (fchmod(fdt, st->st_mode & 07777) < 0)
r = -errno;
(void) futimens(fdt, (struct timespec[]) { st->st_atim, st->st_mtim });
ts[0] = st->st_atim;
ts[1] = st->st_mtim;
(void) futimens(fdt, ts);
(void) copy_xattr(fdf, fdt);
q = close(fdt);
@ -691,8 +693,6 @@ static int fd_copy_fifo(
if (fchmodat(dt, to, st->st_mode & 07777, 0) < 0)
r = -errno;
(void) utimensat(dt, to, (struct timespec[]) { st->st_atim, st->st_mtim }, AT_SYMLINK_NOFOLLOW);
(void) memorize_hardlink(hardlink_context, st, dt, to);
return r;
}
@ -739,8 +739,6 @@ static int fd_copy_node(
if (fchmodat(dt, to, st->st_mode & 07777, 0) < 0)
r = -errno;
(void) utimensat(dt, to, (struct timespec[]) { st->st_atim, st->st_mtim }, AT_SYMLINK_NOFOLLOW);
(void) memorize_hardlink(hardlink_context, st, dt, to);
return r;
}
@ -915,6 +913,11 @@ static int fd_copy_directory(
}
if (created) {
struct timespec ut[2] = {
st->st_atim,
st->st_mtim
};
if (fchown(fdt,
uid_is_valid(override_uid) ? override_uid : st->st_uid,
gid_is_valid(override_gid) ? override_gid : st->st_gid) < 0)
@ -924,7 +927,7 @@ static int fd_copy_directory(
r = -errno;
(void) copy_xattr(dirfd(d), fdt);
(void) futimens(fdt, (struct timespec[]) { st->st_atim, st->st_mtim });
(void) futimens(fdt, ut);
}
return r;
@ -1179,6 +1182,7 @@ int copy_file_atomic_full(
}
int copy_times(int fdf, int fdt, CopyFlags flags) {
struct timespec ut[2];
struct stat st;
assert(fdf >= 0);
@ -1187,7 +1191,10 @@ int copy_times(int fdf, int fdt, CopyFlags flags) {
if (fstat(fdf, &st) < 0)
return -errno;
if (futimens(fdt, (struct timespec[2]) { st.st_atim, st.st_mtim }) < 0)
ut[0] = st.st_atim;
ut[1] = st.st_mtim;
if (futimens(fdt, ut) < 0)
return -errno;
if (FLAGS_SET(flags, COPY_CRTIME)) {

View File

@ -7,13 +7,13 @@
#include "sd-id128.h"
#include "alloc-util.h"
#include "discover-image.h"
#include "export-raw.h"
#include "export-tar.h"
#include "fd-util.h"
#include "fs-util.h"
#include "hostname-util.h"
#include "import-util.h"
#include "machine-image.h"
#include "main-func.h"
#include "signal-util.h"
#include "string-util.h"

View File

@ -8,7 +8,6 @@
#include "alloc-util.h"
#include "btrfs-util.h"
#include "capability-util.h"
#include "chattr-util.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "fileio.h"
@ -23,7 +22,6 @@
#include "util.h"
int import_make_read_only_fd(int fd) {
struct stat st;
int r;
assert(fd >= 0);
@ -31,35 +29,26 @@ int import_make_read_only_fd(int fd) {
/* First, let's make this a read-only subvolume if it refers
* to a subvolume */
r = btrfs_subvol_set_read_only_fd(fd, true);
if (r >= 0)
if (IN_SET(r, -ENOTTY, -ENOTDIR, -EINVAL)) {
struct stat st;
/* This doesn't refer to a subvolume, or the file
* system isn't even btrfs. In that, case fall back to
* chmod()ing */
r = fstat(fd, &st);
if (r < 0)
return log_error_errno(errno, "Failed to stat temporary image: %m");
/* Drop "w" flag */
if (fchmod(fd, st.st_mode & 07555) < 0)
return log_error_errno(errno, "Failed to chmod() final image: %m");
return 0;
if (!ERRNO_IS_NOT_SUPPORTED(r) && !IN_SET(r, -ENOTDIR, -EINVAL))
} else if (r < 0)
return log_error_errno(r, "Failed to make subvolume read-only: %m");
/* This doesn't refer to a subvolume, or the file system isn't even btrfs. In that, case fall back to
* chmod()ing */
r = fstat(fd, &st);
if (r < 0)
return log_error_errno(errno, "Failed to stat image: %m");
if (S_ISDIR(st.st_mode)) {
/* For directories set the immutable flag on the dir itself */
r = chattr_fd(fd, FS_IMMUTABLE_FL, FS_IMMUTABLE_FL, NULL);
if (r < 0)
return log_error_errno(r, "Failed to set +i attribute on directory image: %m");
} else if (S_ISREG(st.st_mode)) {
/* For regular files drop "w" flags */
if ((st.st_mode & 0222) != 0)
if (fchmod(fd, st.st_mode & 07555) < 0)
return log_error_errno(errno, "Failed to chmod() image: %m");
} else
return log_error_errno(SYNTHETIC_ERRNO(EBADFD), "Image of unexpected type");
return 0;
}

View File

@ -5,13 +5,13 @@
#include "alloc-util.h"
#include "btrfs-util.h"
#include "discover-image.h"
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "hostname-util.h"
#include "import-common.h"
#include "import-util.h"
#include "machine-image.h"
#include "mkdir.h"
#include "ratelimit.h"
#include "rm-rf.h"

View File

@ -7,13 +7,13 @@
#include "sd-id128.h"
#include "alloc-util.h"
#include "discover-image.h"
#include "fd-util.h"
#include "fs-util.h"
#include "hostname-util.h"
#include "import-raw.h"
#include "import-tar.h"
#include "import-util.h"
#include "machine-image.h"
#include "main-func.h"
#include "signal-util.h"
#include "string-util.h"

View File

@ -433,16 +433,6 @@ fail:
return 0;
}
static int http_status_ok(CURLcode status) {
/* Consider all HTTP status code in the 2xx range as OK */
return status >= 200 && status <= 299;
}
static int http_status_etag_exists(CURLcode status) {
/* This one is special, it's triggered by our etag mgmt logic */
return status == 304;
}
static size_t pull_job_header_callback(void *contents, size_t size, size_t nmemb, void *userdata) {
_cleanup_free_ char *length = NULL, *last_modified = NULL, *etag = NULL;
size_t sz = size * nmemb;
@ -468,31 +458,28 @@ static size_t pull_job_header_callback(void *contents, size_t size, size_t nmemb
goto fail;
}
if (http_status_ok(status) || http_status_etag_exists(status)) {
/* Check Etag on OK and etag exists responses. */
if (status < 200 || status >= 300)
/* If this is not HTTP 2xx, let's skip these headers, they are probably for
* some redirect or so, and we are not interested in the headers of those. */
return sz;
r = curl_header_strdup(contents, sz, "ETag:", &etag);
if (r < 0) {
log_oom();
goto fail;
}
if (r > 0) {
free_and_replace(j->etag, etag);
if (strv_contains(j->old_etags, j->etag)) {
log_info("Image already downloaded. Skipping download. (%s)", j->etag);
j->etag_exists = true;
pull_job_finish(j, 0);
return sz;
}
r = curl_header_strdup(contents, sz, "ETag:", &etag);
if (r < 0) {
log_oom();
goto fail;
}
if (r > 0) {
free_and_replace(j->etag, etag);
if (strv_contains(j->old_etags, j->etag)) {
log_info("Image already downloaded. Skipping download.");
j->etag_exists = true;
pull_job_finish(j, 0);
return sz;
}
}
if (!http_status_ok(status)) /* Let's ignore the rest here, these requests are probably redirects and
* stuff where the headers aren't interesting to us */
return sz;
}
r = curl_header_strdup(contents, sz, "Content-Length:", &length);
if (r < 0) {

View File

@ -7,9 +7,9 @@
#include "sd-id128.h"
#include "alloc-util.h"
#include "discover-image.h"
#include "hostname-util.h"
#include "import-util.h"
#include "machine-image.h"
#include "main-func.h"
#include "parse-util.h"
#include "pull-raw.h"

View File

@ -8,7 +8,6 @@
#include "bus-label.h"
#include "bus-polkit.h"
#include "copy.h"
#include "discover-image.h"
#include "dissect-image.h"
#include "fd-util.h"
#include "fileio.h"
@ -16,6 +15,7 @@
#include "image-dbus.h"
#include "io-util.h"
#include "loop-util.h"
#include "machine-image.h"
#include "missing_capability.h"
#include "mount-util.h"
#include "process-util.h"

View File

@ -12,7 +12,6 @@
#include "bus-locator.h"
#include "bus-polkit.h"
#include "cgroup-util.h"
#include "discover-image.h"
#include "errno-util.h"
#include "fd-util.h"
#include "fileio.h"
@ -21,6 +20,7 @@
#include "image-dbus.h"
#include "io-util.h"
#include "machine-dbus.h"
#include "machine-image.h"
#include "machine-pool.h"
#include "machined.h"
#include "missing_capability.h"

View File

@ -15,11 +15,11 @@
#include "bus-polkit.h"
#include "cgroup-util.h"
#include "dirent-util.h"
#include "discover-image.h"
#include "fd-util.h"
#include "format-util.h"
#include "hostname-util.h"
#include "label.h"
#include "machine-image.h"
#include "machined-varlink.h"
#include "machined.h"
#include "main-func.h"

View File

@ -36,7 +36,6 @@
#include "copy.h"
#include "cpu-set-util.h"
#include "dev-setup.h"
#include "discover-image.h"
#include "dissect-image.h"
#include "env-util.h"
#include "escape.h"
@ -54,6 +53,7 @@
#include "log.h"
#include "loop-util.h"
#include "loopback-setup.h"
#include "machine-image.h"
#include "macro.h"
#include "main-func.h"
#include "missing_sched.h"

View File

@ -8,7 +8,6 @@
#include "copy.h"
#include "def.h"
#include "dirent-util.h"
#include "discover-image.h"
#include "dissect-image.h"
#include "fd-util.h"
#include "fileio.h"
@ -17,6 +16,7 @@
#include "io-util.h"
#include "locale-util.h"
#include "loop-util.h"
#include "machine-image.h"
#include "mkdir.h"
#include "nulstr-util.h"
#include "os-util.h"

View File

@ -12,13 +12,13 @@
#include "bus-wait-for-jobs.h"
#include "def.h"
#include "dirent-util.h"
#include "discover-image.h"
#include "env-file.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-table.h"
#include "fs-util.h"
#include "locale-util.h"
#include "machine-image.h"
#include "main-func.h"
#include "pager.h"
#include "parse-util.h"

View File

@ -4,9 +4,9 @@
#include "btrfs-util.h"
#include "bus-common-errors.h"
#include "bus-polkit.h"
#include "discover-image.h"
#include "fd-util.h"
#include "io-util.h"
#include "machine-image.h"
#include "missing_capability.h"
#include "portable.h"
#include "portabled-bus.h"

View File

@ -11,10 +11,10 @@
#include "bus-label.h"
#include "bus-polkit.h"
#include "bus-util.h"
#include "discover-image.h"
#include "fd-util.h"
#include "fileio.h"
#include "io-util.h"
#include "machine-image.h"
#include "missing_capability.h"
#include "portable.h"
#include "portabled-bus.h"

View File

@ -3,7 +3,7 @@
#include "sd-bus.h"
#include "discover-image.h"
#include "machine-image.h"
#include "portabled.h"
int bus_image_common_get_os_release(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error);

View File

@ -1,8 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "discover-image.h"
#include "hashmap.h"
#include "machine-image.h"
#include "portabled.h"
Image *manager_image_cache_get(Manager *m, const char *name_or_path);

View File

@ -2500,90 +2500,6 @@ static int verb_log_level(int argc, char *argv[], void *userdata) {
return 0;
}
static const char *resolve_flags_to_string(uint64_t flags) {
return flags & SD_RESOLVED_DNS ? "DNS" :
flags & SD_RESOLVED_LLMNR_IPV4 ? "LLMNR/IPv4" :
flags & SD_RESOLVED_LLMNR_IPV6 ? "LLMNR/IPv6" :
flags & SD_RESOLVED_MDNS_IPV4 ? "mDNS/IPv4" :
flags & SD_RESOLVED_MDNS_IPV6 ? "mDNS/IPv6" :
"";
}
static int verb_show_multicast(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_(table_unrefp) Table *table = NULL;
sd_bus *bus = userdata;
int r;
assert(bus);
table = table_new("Hostname", "Address", "Source");
if (!table)
return log_oom();
r = bus_call_method(bus, bus_resolve_mgr, "GetMulticastHosts", &error, &reply, NULL);
if (r < 0)
return log_error_errno(r, "Failed to query systemd-resolved: %s", bus_error_message(&error, r));
r = sd_bus_message_enter_container(reply, 'a', "(stiiay)");
if (r < 0)
return bus_log_parse_error(r);
while ((r = sd_bus_message_enter_container(reply, 'r', "stiiay")) > 0) {
char *canonical;
uint64_t flags;
_cleanup_free_ char *pretty = NULL;
int ifindex, family;
union in_addr_union a;
r = sd_bus_message_read(reply, "st", &canonical, &flags);
if (r < 0)
return bus_log_parse_error(r);
r = sd_bus_message_read(reply, "i", &ifindex);
if (r < 0)
return bus_log_parse_error(r);
sd_bus_error_free(&error);
r = bus_message_read_in_addr_auto(reply, &error, &family, &a);
if (r < 0)
return log_error_errno(
r,
"systemd-resolved returned invalid result: %s",
bus_error_message(&error, r));
r = sd_bus_message_exit_container(reply);
if (r < 0)
return bus_log_parse_error(r);
r = in_addr_ifindex_to_string(family, &a, ifindex, &pretty);
if (r < 0)
return log_error_errno(r, "Failed to print address: %m");
r = table_add_many(
table,
TABLE_STRING,
canonical,
TABLE_STRING,
pretty,
TABLE_STRING,
resolve_flags_to_string(flags));
if (r < 0)
return table_log_add_error(r);
}
r = sd_bus_message_exit_container(reply);
if (r < 0)
return bus_log_parse_error(r);
r = table_print(table, NULL);
if (r < 0)
return table_log_print_error(r);
return 0;
}
static void help_protocol_types(void) {
if (arg_legend)
puts("Known protocol types:");
@ -2693,7 +2609,6 @@ static int native_help(void) {
" nta [LINK [DOMAIN...]] Get/set per-interface DNSSEC NTA\n"
" revert LINK Revert per-interface configuration\n"
" log-level [LEVEL] Get/set logging threshold for systemd-resolved\n"
" show-multicast Show domain names discovered via LLMNR/mDNS\n"
"\nOptions:\n"
" -h --help Show this help\n"
" --version Show package version\n"
@ -3237,7 +3152,7 @@ static int native_parse_argv(int argc, char *argv[]) {
}
static int native_main(int argc, char *argv[], sd_bus *bus) {
/* clang-format off */
static const Verb verbs[] = {
{ "help", VERB_ANY, VERB_ANY, 0, verb_help },
{ "status", VERB_ANY, VERB_ANY, VERB_DEFAULT, verb_status },
@ -3259,10 +3174,8 @@ static int native_main(int argc, char *argv[], sd_bus *bus) {
{ "nta", VERB_ANY, VERB_ANY, 0, verb_nta },
{ "revert", VERB_ANY, 2, 0, verb_revert_link },
{ "log-level", VERB_ANY, 2, 0, verb_log_level },
{ "show-multicast", VERB_ANY, VERB_ANY, 0, verb_show_multicast },
{}
};
/* clang-format on */
return dispatch_verb(argc, argv, verbs, bus);
}

View File

@ -132,17 +132,15 @@ static int reply_query_state(DnsQuery *q) {
}
}
static int append_address(sd_bus_message *reply, DnsResourceRecord *rr, int ifindex, bool is_container) {
static int append_address(sd_bus_message *reply, DnsResourceRecord *rr, int ifindex) {
int r;
assert(reply);
assert(rr);
if (is_container) {
r = sd_bus_message_open_container(reply, 'r', "iiay");
if (r < 0)
return r;
}
r = sd_bus_message_open_container(reply, 'r', "iiay");
if (r < 0)
return r;
r = sd_bus_message_append(reply, "i", ifindex);
if (r < 0)
@ -167,11 +165,9 @@ static int append_address(sd_bus_message *reply, DnsResourceRecord *rr, int ifin
if (r < 0)
return r;
if (is_container) {
r = sd_bus_message_close_container(reply);
if (r < 0)
return r;
}
r = sd_bus_message_close_container(reply);
if (r < 0)
return r;
return 0;
}
@ -220,7 +216,7 @@ static void bus_method_resolve_hostname_complete(DnsQuery *q) {
if (r == 0)
continue;
r = append_address(reply, rr, ifindex, true);
r = append_address(reply, rr, ifindex);
if (r < 0)
goto finish;
@ -855,7 +851,7 @@ static int append_srv(DnsQuery *q, sd_bus_message *reply, DnsResourceRecord *rr)
if (r == 0)
continue;
r = append_address(reply, zz, ifindex, true);
r = append_address(reply, zz, ifindex);
if (r < 0)
return r;
}
@ -2004,76 +2000,6 @@ static int bus_method_unregister_service(sd_bus_message *message, void *userdata
return call_dnssd_method(m, message, bus_dnssd_method_unregister, error);
}
static int bus_method_get_multicast_hosts(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
DnsScope *s;
Manager *m = userdata;
int r;
assert(message);
assert(m);
r = sd_bus_message_new_method_return(message, &reply);
if (r < 0)
return r;
r = sd_bus_message_open_container(reply, 'a', "(stiiay)");
if (r < 0)
return r;
LIST_FOREACH(scopes, s, m->dns_scopes) {
_cleanup_(dns_answer_unrefp) DnsAnswer *answer = NULL;
DnsResourceRecord *rr;
DnsAnswerFlags flags;
int ifindex;
if (s->protocol == DNS_PROTOCOL_DNS)
continue;
r = dns_cache_dump_to_answer(&s->cache, &answer);
if (r < 0)
return r;
if (r == 0)
continue;
DNS_ANSWER_FOREACH_FULL(rr, ifindex, flags, answer) {
_cleanup_free_ char *normalized = NULL;
bool authenticated = FLAGS_SET(flags, DNS_ANSWER_AUTHENTICATED);
r = dns_name_normalize(dns_resource_key_name(rr->key), 0, &normalized);
if (r < 0)
return r;
r = sd_bus_message_open_container(reply, 'r', "stiiay");
if (r < 0)
return r;
r = sd_bus_message_append(
reply,
"st",
normalized,
SD_RESOLVED_FLAGS_MAKE(s->protocol, s->family, authenticated));
if (r < 0)
return r;
r = append_address(reply, rr, ifindex, false);
if (r < 0)
return r;
r = sd_bus_message_close_container(reply);
if (r < 0)
return r;
}
}
r = sd_bus_message_close_container(reply);
if (r < 0)
return r;
return sd_bus_reply(message, reply);
}
/* clang-format off */
static const sd_bus_vtable resolve_vtable[] = {
SD_BUS_VTABLE_START(0),
SD_BUS_PROPERTY("LLMNRHostname", "s", NULL, offsetof(Manager, llmnr_hostname), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
@ -2212,14 +2138,9 @@ static const sd_bus_vtable resolve_vtable[] = {
SD_BUS_NO_RESULT,
bus_method_reset_server_features,
SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD_WITH_ARGS("GetMulticastHosts",
SD_BUS_NO_ARGS,
SD_BUS_RESULT("a(stiiay)", addresses),
bus_method_get_multicast_hosts,
SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_VTABLE_END,
};
/* clang-format on */
const BusObjectImplementation manager_object = {
"/org/freedesktop/resolve1",

View File

@ -1066,55 +1066,7 @@ int dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p) {
return 0;
}
int dns_cache_dump_to_answer(DnsCache *cache, DnsAnswer **ret) {
_cleanup_(dns_answer_unrefp) DnsAnswer *answer = NULL;
DnsCacheItem *i;
size_t n = 0;
int r;
assert(cache);
assert(ret);
HASHMAP_FOREACH(i, cache->by_key) {
DnsCacheItem *j;
LIST_FOREACH(by_key, j, i) {
if (!j->rr)
continue;
n++;
}
}
if (n == 0) {
*ret = NULL;
return 0;
}
answer = dns_answer_new(n);
if (!answer)
return -ENOMEM;
HASHMAP_FOREACH(i, cache->by_key) {
DnsCacheItem *j;
LIST_FOREACH(by_key, j, i) {
if (!j->rr)
continue;
r = dns_answer_add(
answer, j->rr, j->ifindex, j->authenticated ? DNS_ANSWER_AUTHENTICATED : 0);
if (r < 0)
return r;
}
}
*ret = TAKE_PTR(answer);
return n;
}
void dns_cache_dump_to_file(DnsCache *cache, FILE *f) {
void dns_cache_dump(DnsCache *cache, FILE *f) {
DnsCacheItem *i;
if (!cache)

View File

@ -27,8 +27,7 @@ int dns_cache_lookup(DnsCache *c, DnsResourceKey *key, bool clamp_ttl, int *rcod
int dns_cache_check_conflicts(DnsCache *cache, DnsResourceRecord *rr, int owner_family, const union in_addr_union *owner_address);
void dns_cache_dump_to_file(DnsCache *cache, FILE *f);
int dns_cache_dump_to_answer(DnsCache *cache, DnsAnswer **answer);
void dns_cache_dump(DnsCache *cache, FILE *f);
bool dns_cache_is_empty(DnsCache *cache);
unsigned dns_cache_size(DnsCache *cache);

View File

@ -1159,7 +1159,7 @@ void dns_scope_dump(DnsScope *s, FILE *f) {
if (!dns_cache_is_empty(&s->cache)) {
fputs("CACHE:\n", f);
dns_cache_dump_to_file(&s->cache, f);
dns_cache_dump(&s->cache, f);
}
}

View File

@ -16,7 +16,6 @@
#include "chattr-util.h"
#include "copy.h"
#include "dirent-util.h"
#include "discover-image.h"
#include "dissect-image.h"
#include "env-file.h"
#include "env-util.h"
@ -28,6 +27,7 @@
#include "lockfile-util.h"
#include "log.h"
#include "loop-util.h"
#include "machine-image.h"
#include "macro.h"
#include "mkdir.h"
#include "nulstr-util.h"
@ -1065,6 +1065,7 @@ int image_path_lock(const char *path, int operation, LockFile *global, LockFile
r = asprintf(&p, "/run/systemd/nspawn/locks/inode-%lu:%lu", (unsigned long) st.st_dev, (unsigned long) st.st_ino);
else
return -ENOTTY;
if (r < 0)
return -ENOMEM;
}
@ -1219,16 +1220,11 @@ int image_read_metadata(Image *i) {
}
int image_name_lock(const char *name, int operation, LockFile *ret) {
const char *p;
assert(name);
assert(ret);
/* Locks an image name, regardless of the precise path used. */
if (streq(name, ".host"))
return -EBUSY;
if (!image_name_is_valid(name))
return -EINVAL;
@ -1237,9 +1233,11 @@ int image_name_lock(const char *name, int operation, LockFile *ret) {
return 0;
}
(void) mkdir_p("/run/systemd/nspawn/locks", 0700);
if (streq(name, ".host"))
return -EBUSY;
p = strjoina("/run/systemd/nspawn/locks/name-", name);
const char *p = strjoina("/run/systemd/nspawn/locks/name-", name);
(void) mkdir_p("/run/systemd/nspawn/locks", 0700);
return make_lock_file(p, operation, ret);
}

View File

@ -79,8 +79,6 @@ shared_sources = files('''
dev-setup.c
dev-setup.h
devnode-acl.h
discover-image.c
discover-image.h
dissect-image.c
dissect-image.h
dm-util.c
@ -174,6 +172,8 @@ shared_sources = files('''
loopback-setup.h
machine-id-setup.c
machine-id-setup.h
machine-image.c
machine-image.h
machine-pool.c
machine-pool.h
macvlan-util.c

View File

@ -1,12 +1,12 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "discover-image.h"
#include "env-file.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "macro.h"
#include "machine-image.h"
#include "os-util.h"
#include "string-util.h"
#include "strv.h"

View File

@ -6,7 +6,6 @@
#include <unistd.h>
#include "capability-util.h"
#include "discover-image.h"
#include "dissect-image.h"
#include "escape.h"
#include "fd-util.h"
@ -15,6 +14,7 @@
#include "fs-util.h"
#include "hashmap.h"
#include "log.h"
#include "machine-image.h"
#include "main-func.h"
#include "missing_magic.h"
#include "mkdir.h"

View File

@ -8,7 +8,6 @@
#include "condition.h"
#include "device-private.h"
#include "device.h"
#include "discover-image.h"
#include "execute.h"
#include "import-util.h"
#include "install.h"
@ -19,6 +18,7 @@
#include "locale-util.h"
#include "log.h"
#include "logs-show.h"
#include "machine-image.h"
#include "mount.h"
#include "path.h"
#include "process-util.h"