mirror of
https://github.com/systemd/systemd
synced 2026-03-26 08:44:55 +01:00
Compare commits
No commits in common. "d065fdd33765cb65bbff97d0fee01b49e30d023e" and "ca1d2ae5d6bedfbd387427409fb331e223512ad9" have entirely different histories.
d065fdd337
...
ca1d2ae5d6
@ -756,6 +756,10 @@ sensor:modalias:acpi:BMA250E*:dmi:bvnLENOVO:*:pvrLenovoMIIX3-1030:*
|
||||
sensor:modalias:acpi:SMO8500*:dmi:bvnLENOVO:*:pvrLenovoMIIX3-830:*
|
||||
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, 1, 0; 0, 0, 1
|
||||
|
||||
# IdeaPad D330-10IGM (both 81H3 and 81MD product names)
|
||||
sensor:modalias:acpi:BOSC0200*:dmi:*:svnLENOVO:*:pvrLenovoideapadD330-10IGM:*
|
||||
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
|
||||
|
||||
# IdeaPad Miix 300
|
||||
sensor:modalias:acpi:SMO8500*:dmi:bvnLENOVO:*:pvrMIIX300-*:*
|
||||
ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1
|
||||
|
||||
@ -38,12 +38,10 @@
|
||||
|
||||
<para>The file should contain a single newline-terminated hostname string. Comments (lines starting with
|
||||
a <literal>#</literal>) are ignored. The hostname should be composed of up to 64 7-bit ASCII lower-case
|
||||
alphanumeric characters or hyphens forming a valid DNS domain name. It is strongly recommended that this
|
||||
name contains only a single DNS label, i.e does not contain any dots. This recommendation reflects both
|
||||
usual expectations of applications, and the fact that the Linux kernel limits the length of the system
|
||||
hostname to 64 (i.e. close to the maximum DNS label length of 63) rather than 255 (the maximum DNS domain
|
||||
name length). When applied, invalid characters will be filtered out in an attempt to make the name valid,
|
||||
but obviously it is recommended to use a valid name and not rely on this filtering.</para>
|
||||
alphanumeric characters or hyphens forming a valid DNS domain name. It is recommended that this name
|
||||
contains only a single label, i.e. without any dots. Invalid characters will be filtered out in an
|
||||
attempt to make the name valid, but obviously it is recommended to use a valid name and not rely on this
|
||||
filtering.</para>
|
||||
|
||||
<para id="question-mark-hostname-pattern">If the question mark character <literal>?</literal> appears in
|
||||
the hostname, it is automatically substituted by a hexadecimal character derived from the
|
||||
|
||||
@ -1263,10 +1263,12 @@ int flush_accept(int fd) {
|
||||
int cfd;
|
||||
|
||||
r = fd_wait_for_event(fd, POLLIN, 0);
|
||||
if (r < 0) {
|
||||
if (r == -EINTR)
|
||||
continue;
|
||||
if (r < 0)
|
||||
|
||||
return r;
|
||||
}
|
||||
if (r == 0)
|
||||
return 0;
|
||||
|
||||
@ -1303,10 +1305,12 @@ ssize_t flush_mqueue(int fd) {
|
||||
ssize_t l;
|
||||
|
||||
r = fd_wait_for_event(fd, POLLIN, /* timeout= */ 0);
|
||||
if (r < 0) {
|
||||
if (r == -EINTR)
|
||||
continue;
|
||||
if (r < 0)
|
||||
|
||||
return r;
|
||||
}
|
||||
if (r == 0)
|
||||
return count;
|
||||
|
||||
|
||||
@ -199,10 +199,12 @@ static Virtualization detect_vm_dmi_vendor(void) {
|
||||
_cleanup_free_ char *s = NULL;
|
||||
|
||||
r = read_one_line_file(*vendor, &s);
|
||||
if (r < 0) {
|
||||
if (r == -ENOENT)
|
||||
continue;
|
||||
if (r < 0)
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
FOREACH_ELEMENT(dmi_vendor, dmi_vendor_table)
|
||||
if (startswith(s, dmi_vendor->vendor)) {
|
||||
|
||||
@ -810,10 +810,12 @@ static int report_credentials_per_func(const char *title, int (*get_directory_fu
|
||||
assert(get_directory_func);
|
||||
|
||||
r = get_directory_func(&d);
|
||||
if (r < 0) {
|
||||
if (r == -ENXIO) /* Env var not set */
|
||||
return 0;
|
||||
if (r < 0)
|
||||
|
||||
return log_warning_errno(r, "Failed to determine %s directory: %m", title);
|
||||
}
|
||||
|
||||
r = readdir_all_at(AT_FDCWD, d, RECURSE_DIR_SORT|RECURSE_DIR_IGNORE_DOT, &de);
|
||||
if (r < 0)
|
||||
|
||||
@ -5573,13 +5573,16 @@ int config_parse_emergency_action(
|
||||
runtime_scope = ltype; /* otherwise, assume the scope is passed in via ltype */
|
||||
|
||||
r = parse_emergency_action(rvalue, runtime_scope, x);
|
||||
if (r < 0) {
|
||||
if (r == -EOPNOTSUPP)
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"%s= specified as %s mode action, ignoring: %s",
|
||||
lvalue, runtime_scope_to_string(runtime_scope), rvalue);
|
||||
else if (r < 0)
|
||||
else
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to parse %s=, ignoring: %s", lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -198,16 +198,18 @@ static int manager_deserialize_one_unit(Manager *m, const char *name, FILE *f, F
|
||||
int r;
|
||||
|
||||
r = manager_load_unit(m, name, NULL, NULL, &u);
|
||||
if (r < 0) {
|
||||
if (r == -ENOMEM)
|
||||
return log_oom();
|
||||
if (r < 0)
|
||||
return r;
|
||||
return log_notice_errno(r, "Failed to load unit \"%s\", skipping deserialization: %m", name);
|
||||
}
|
||||
|
||||
r = unit_deserialize_state(u, f, fds);
|
||||
if (r < 0) {
|
||||
if (r == -ENOMEM)
|
||||
return log_oom();
|
||||
if (r < 0)
|
||||
return r;
|
||||
return log_notice_errno(r, "Failed to deserialize unit \"%s\", skipping: %m", name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -174,6 +174,7 @@ static int run(int argc, char *argv[]) {
|
||||
case ACTION_ESCAPE:
|
||||
if (arg_path) {
|
||||
r = unit_name_path_escape(*i, &e);
|
||||
if (r < 0) {
|
||||
if (r == -EINVAL) {
|
||||
/* If escaping failed because the string was invalid, let's print a
|
||||
* friendly message about it. Catch these specific error cases
|
||||
@ -186,9 +187,10 @@ static int run(int argc, char *argv[]) {
|
||||
if (!path_is_normalized(*i))
|
||||
return log_error_errno(r, "Input '%s' is not a normalized file system path, failed to escape.", *i);
|
||||
}
|
||||
if (r < 0)
|
||||
|
||||
/* All other error cases. */
|
||||
return log_error_errno(r, "Failed to escape string: %m");
|
||||
}
|
||||
|
||||
/* If the escaping worked, then still warn if the path is not like we'd like
|
||||
* it. Because that means escaping is not necessarily reversible. */
|
||||
|
||||
@ -71,10 +71,12 @@ static int fscrypt_unlink_key(UserRecord *h) {
|
||||
char *d;
|
||||
|
||||
r = keyring_describe(*key, &description);
|
||||
if (r < 0) {
|
||||
if (r == -ENOKEY) /* Something else deleted it already, that's ok. */
|
||||
continue;
|
||||
if (r < 0)
|
||||
|
||||
return log_error_errno(r, "Failed to describe key id %d: %m", *key);
|
||||
}
|
||||
|
||||
/* The description is the final element as per manpage. */
|
||||
d = strrchr(description, ';');
|
||||
|
||||
@ -2353,12 +2353,16 @@ int home_create_luks(
|
||||
0,
|
||||
LOCK_EX,
|
||||
&setup->loop);
|
||||
if (r == -ENOENT) /* this means /dev/loop-control doesn't exist, i.e. we are in a container
|
||||
if (r < 0) {
|
||||
if (r == -ENOENT) { /* this means /dev/loop-control doesn't exist, i.e. we are in a container
|
||||
* or similar and loopback bock devices are not available, return a
|
||||
* recognizable error in this case. */
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENOLINK), "Loopback block device support is not available on this system.");
|
||||
if (r < 0)
|
||||
log_error_errno(r, "Loopback block device support is not available on this system.");
|
||||
return -ENOLINK; /* Make recognizable */
|
||||
}
|
||||
|
||||
return log_error_errno(r, "Failed to set up loopback device for %s: %m", setup->temporary_image_path);
|
||||
}
|
||||
|
||||
log_info("Setting up loopback device %s completed.", setup->loop->node ?: ip);
|
||||
|
||||
|
||||
@ -1802,10 +1802,12 @@ int device_read_db_internal_filename(sd_device *device, const char *filename) {
|
||||
assert(filename);
|
||||
|
||||
r = read_full_file(filename, &db, &db_len);
|
||||
if (r < 0) {
|
||||
if (r == -ENOENT)
|
||||
return 0;
|
||||
if (r < 0)
|
||||
|
||||
return log_device_debug_errno(device, r, "sd-device: Failed to read db '%s': %m", filename);
|
||||
}
|
||||
|
||||
/* devices with a database entry are initialized */
|
||||
device->is_initialized = true;
|
||||
|
||||
@ -772,13 +772,14 @@ int manager_read_efi_boot_loader_entries(Manager *m) {
|
||||
return 0;
|
||||
|
||||
r = efi_loader_get_entries(&m->efi_boot_loader_entries);
|
||||
if (r == -ENOENT || ERRNO_IS_NEG_NOT_SUPPORTED(r)) {
|
||||
if (r < 0) {
|
||||
if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r)) {
|
||||
log_debug_errno(r, "Boot loader reported no entries.");
|
||||
m->efi_boot_loader_entries_set = true;
|
||||
return 0;
|
||||
}
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine entries reported by boot loader: %m");
|
||||
}
|
||||
|
||||
m->efi_boot_loader_entries_set = true;
|
||||
return 1;
|
||||
|
||||
@ -2820,13 +2820,15 @@ static int method_schedule_shutdown(sd_bus_message *message, void *userdata, sd_
|
||||
if (elapse == USEC_INFINITY) {
|
||||
if (m->maintenance_time) {
|
||||
r = calendar_spec_next_usec(m->maintenance_time, now(CLOCK_REALTIME), &elapse);
|
||||
if (r < 0) {
|
||||
if (r == -ENOENT)
|
||||
return sd_bus_error_set(error,
|
||||
BUS_ERROR_DESIGNATED_MAINTENANCE_TIME_NOT_SCHEDULED,
|
||||
"No upcoming maintenance window scheduled");
|
||||
if (r < 0)
|
||||
|
||||
return sd_bus_error_set_errnof(error, r,
|
||||
"Failed to determine next maintenance window: %m");
|
||||
}
|
||||
|
||||
log_info("Scheduled %s at maintenance window %s", type, FORMAT_TIMESTAMP(elapse));
|
||||
} else
|
||||
|
||||
@ -8297,12 +8297,13 @@ static int context_fstab(Context *context) {
|
||||
switch (arg_append_fstab) {
|
||||
case APPEND_AUTO: {
|
||||
r = read_full_file(path, &c, NULL);
|
||||
if (r < 0) {
|
||||
if (r == -ENOENT) {
|
||||
log_debug("File fstab not found in %s", path);
|
||||
break;
|
||||
}
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to open %s: %m", path);
|
||||
}
|
||||
|
||||
const char *acs, *ace;
|
||||
acs = find_line(c, AUTOMATIC_FSTAB_HEADER_START);
|
||||
@ -9712,10 +9713,11 @@ static int parse_efi_variable_factory_reset(void) {
|
||||
return 0;
|
||||
|
||||
r = efi_get_variable_string(EFI_SYSTEMD_VARIABLE_STR("FactoryReset"), &value);
|
||||
if (r == -ENOENT || ERRNO_IS_NEG_NOT_SUPPORTED(r))
|
||||
if (r < 0) {
|
||||
if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r))
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to read EFI variable FactoryReset: %m");
|
||||
}
|
||||
|
||||
log_warning("Warning, EFI variable FactoryReset is in use, please migrate to use FactoryResetRequest instead, support will be removed in v260!");
|
||||
|
||||
@ -9736,10 +9738,11 @@ static int remove_efi_variable_factory_reset(void) {
|
||||
// FIXME: Remove this in v260, see above
|
||||
|
||||
r = efi_set_variable(EFI_SYSTEMD_VARIABLE_STR("FactoryReset"), NULL, 0);
|
||||
if (r == -ENOENT || ERRNO_IS_NEG_NOT_SUPPORTED(r))
|
||||
if (r < 0) {
|
||||
if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r))
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to remove EFI variable FactoryReset: %m");
|
||||
}
|
||||
|
||||
log_info("Successfully unset EFI variable FactoryReset.");
|
||||
return 0;
|
||||
|
||||
@ -68,27 +68,10 @@ static inline int acl_set_perm(acl_permset_t ps, acl_perm_t p, bool b) {
|
||||
|
||||
#else
|
||||
|
||||
typedef void *acl_t;
|
||||
typedef int acl_tag_t;
|
||||
typedef unsigned acl_type_t;
|
||||
|
||||
#define ACL_READ 0x04
|
||||
#define ACL_WRITE 0x02
|
||||
#define ACL_EXECUTE 0x01
|
||||
|
||||
/* acl_tag_t */
|
||||
#define ACL_UNDEFINED_TAG (0x00)
|
||||
#define ACL_USER_OBJ (0x01)
|
||||
#define ACL_USER (0x02)
|
||||
#define ACL_GROUP_OBJ (0x04)
|
||||
#define ACL_GROUP (0x08)
|
||||
#define ACL_MASK (0x10)
|
||||
#define ACL_OTHER (0x20)
|
||||
|
||||
/* acl_type_t */
|
||||
#define ACL_TYPE_ACCESS (0x8000)
|
||||
#define ACL_TYPE_DEFAULT (0x4000)
|
||||
|
||||
static inline int dlopen_libacl(void) {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
@ -161,31 +161,28 @@ static int bus_job_get_service_result(BusWaitForJobs *d, char **ret) {
|
||||
ret);
|
||||
}
|
||||
|
||||
static int log_job_error_with_service_result(
|
||||
static void log_job_error_with_service_result(
|
||||
const char* service,
|
||||
const char *result,
|
||||
bool quiet,
|
||||
const char* const* extra_args) {
|
||||
|
||||
static const struct {
|
||||
const char *result;
|
||||
int error;
|
||||
const char *explanation;
|
||||
const char *result, *explanation;
|
||||
} explanations[] = {
|
||||
{ "resources", EMFILE, "of unavailable resources or another system error" },
|
||||
{ "protocol", EPROTONOSUPPORT, "the service did not take the steps required by its unit configuration" },
|
||||
{ "timeout", ETIMEDOUT, "a timeout was exceeded" },
|
||||
{ "exit-code", EBADE, "the control process exited with error code" },
|
||||
{ "signal", ENOTRECOVERABLE, "a fatal signal was delivered to the control process" },
|
||||
{ "core-dump", ECONNABORTED, "a fatal signal was delivered causing the control process to dump core" },
|
||||
{ "watchdog", ECONNRESET, "the service failed to send watchdog ping" },
|
||||
{ "start-limit-hit", EBUSY, "start of the service was attempted too often" },
|
||||
{ "oom-kill", ENOMEM, "of an out-of-memory (OOM) situation" },
|
||||
{ "resources", "of unavailable resources or another system error" },
|
||||
{ "protocol", "the service did not take the steps required by its unit configuration" },
|
||||
{ "timeout", "a timeout was exceeded" },
|
||||
{ "exit-code", "the control process exited with error code" },
|
||||
{ "signal", "a fatal signal was delivered to the control process" },
|
||||
{ "core-dump", "a fatal signal was delivered causing the control process to dump core" },
|
||||
{ "watchdog", "the service failed to send watchdog ping" },
|
||||
{ "start-limit-hit", "start of the service was attempted too often" },
|
||||
{ "oom-kill", "of an out-of-memory (OOM) siutation" },
|
||||
};
|
||||
|
||||
_cleanup_free_ char *service_shell_quoted = NULL;
|
||||
const char *systemctl = "systemctl", *journalctl = "journalctl";
|
||||
int r;
|
||||
|
||||
assert(service);
|
||||
|
||||
@ -202,8 +199,7 @@ static int log_job_error_with_service_result(
|
||||
if (!isempty(result))
|
||||
FOREACH_ELEMENT(i, explanations)
|
||||
if (streq(result, i->result)) {
|
||||
r = log_full_errno(quiet ? LOG_DEBUG : LOG_ERR,
|
||||
SYNTHETIC_ERRNO(i->error),
|
||||
log_full(quiet ? LOG_DEBUG : LOG_ERR,
|
||||
"Job for %s failed because %s.\n"
|
||||
"See \"%s status %s\" and \"%s -xeu %s\" for details.\n",
|
||||
service, i->explanation,
|
||||
@ -212,8 +208,7 @@ static int log_job_error_with_service_result(
|
||||
goto extra;
|
||||
}
|
||||
|
||||
r = log_full_errno(quiet ? LOG_DEBUG : LOG_ERR,
|
||||
SYNTHETIC_ERRNO(ENOMEDIUM),
|
||||
log_full(quiet ? LOG_DEBUG : LOG_ERR,
|
||||
"Job for %s failed.\n"
|
||||
"See \"%s status %s\" and \"%s -xeu %s\" for details.\n",
|
||||
service,
|
||||
@ -228,8 +223,6 @@ extra:
|
||||
"followed by \"%1$s start %2$s\" again.",
|
||||
systemctl,
|
||||
service_shell_quoted ?: "<service>");
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int check_wait_response(BusWaitForJobs *d, WaitJobsFlags flags, const char* const* extra_args) {
|
||||
@ -254,44 +247,60 @@ static int check_wait_response(BusWaitForJobs *d, WaitJobsFlags flags, const cha
|
||||
int priority = FLAGS_SET(flags, BUS_WAIT_JOBS_LOG_ERROR) ? LOG_ERR : LOG_DEBUG;
|
||||
|
||||
if (streq(d->result, "canceled"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(ECANCELED), "Job for %s canceled.", d->name);
|
||||
if (streq(d->result, "timeout"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(ETIME), "Job for %s timed out.", d->name);
|
||||
if (streq(d->result, "dependency"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(EIO), "A dependency job for %s failed. See 'journalctl -xe' for details.", d->name);
|
||||
if (streq(d->result, "invalid"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(ENOEXEC), "%s is not active, cannot reload.", d->name);
|
||||
if (streq(d->result, "assert"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(EPROTO), "Assertion failed on job for %s.", d->name);
|
||||
if (streq(d->result, "unsupported"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(EOPNOTSUPP), "Operation on or unit type of %s not supported on this system.", d->name);
|
||||
if (streq(d->result, "collected"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(ECANCELED), "Queued job for %s was garbage collected.", d->name);
|
||||
if (streq(d->result, "once"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(ESTALE), "Unit %s was started already once and can't be started again.", d->name);
|
||||
if (streq(d->result, "frozen"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(EDEADLK), "Cannot perform operation on frozen unit %s.", d->name);
|
||||
if (streq(d->result, "concurrency"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(ETOOMANYREFS), "Concurrency limit of a slice unit %s is contained in has been reached.", d->name);
|
||||
|
||||
if (!streq(d->result, "failed"))
|
||||
log_debug("Unexpected job result '%s' for unit '%s', assuming server side newer than us.",
|
||||
d->result, d->name);
|
||||
|
||||
/* Job is failed, or result is unknown. For non-service units, just show a generic message. */
|
||||
if (!endswith(d->name, ".service"))
|
||||
return log_full_errno(priority, SYNTHETIC_ERRNO(ENOMEDIUM), "Job failed. See \"journalctl -xe\" for details.");
|
||||
|
||||
/* For services, let's also try Result property. */
|
||||
log_full(priority, "Job for %s canceled.", d->name);
|
||||
else if (streq(d->result, "timeout"))
|
||||
log_full(priority, "Job for %s timed out.", d->name);
|
||||
else if (streq(d->result, "dependency"))
|
||||
log_full(priority, "A dependency job for %s failed. See 'journalctl -xe' for details.", d->name);
|
||||
else if (streq(d->result, "invalid"))
|
||||
log_full(priority, "%s is not active, cannot reload.", d->name);
|
||||
else if (streq(d->result, "assert"))
|
||||
log_full(priority, "Assertion failed on job for %s.", d->name);
|
||||
else if (streq(d->result, "unsupported"))
|
||||
log_full(priority, "Operation on or unit type of %s not supported on this system.", d->name);
|
||||
else if (streq(d->result, "collected"))
|
||||
log_full(priority, "Queued job for %s was garbage collected.", d->name);
|
||||
else if (streq(d->result, "once"))
|
||||
log_full(priority, "Unit %s was started already once and can't be started again.", d->name);
|
||||
else if (streq(d->result, "frozen"))
|
||||
log_full(priority, "Cannot perform operation on frozen unit %s.", d->name);
|
||||
else if (streq(d->result, "concurrency"))
|
||||
log_full(priority, "Concurrency limit of a slice unit %s is contained in has been reached.", d->name);
|
||||
else if (endswith(d->name, ".service")) {
|
||||
/* Job result is unknown. For services, let's also try Result property. */
|
||||
_cleanup_free_ char *result = NULL;
|
||||
|
||||
r = bus_job_get_service_result(d, &result);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to get Result property of unit %s, ignoring: %m", d->name);
|
||||
log_debug_errno(r, "Failed to get Result property of unit %s, ignoring: %m",
|
||||
d->name);
|
||||
|
||||
return log_job_error_with_service_result(
|
||||
d->name, result,
|
||||
/* quiet= */ !FLAGS_SET(flags, BUS_WAIT_JOBS_LOG_ERROR),
|
||||
extra_args);
|
||||
log_job_error_with_service_result(d->name, result, priority, extra_args);
|
||||
} else /* Otherwise we just show a generic message. */
|
||||
log_full(priority, "Job failed. See \"journalctl -xe\" for details.");
|
||||
|
||||
if (STR_IN_SET(d->result, "canceled", "collected"))
|
||||
return -ECANCELED;
|
||||
else if (streq(d->result, "timeout"))
|
||||
return -ETIME;
|
||||
else if (streq(d->result, "dependency"))
|
||||
return -EIO;
|
||||
else if (streq(d->result, "invalid"))
|
||||
return -ENOEXEC;
|
||||
else if (streq(d->result, "assert"))
|
||||
return -EPROTO;
|
||||
else if (streq(d->result, "unsupported"))
|
||||
return -EOPNOTSUPP;
|
||||
else if (streq(d->result, "once"))
|
||||
return -ESTALE;
|
||||
else if (streq(d->result, "frozen"))
|
||||
return -EDEADLK;
|
||||
else if (streq(d->result, "concurrency"))
|
||||
return -ETOOMANYREFS;
|
||||
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENOMEDIUM),
|
||||
"Unexpected job result '%s' for unit '%s', assuming server side newer than us.",
|
||||
d->result, d->name);
|
||||
}
|
||||
|
||||
int bus_wait_for_jobs(BusWaitForJobs *d, WaitJobsFlags flags, const char* const* extra_args) {
|
||||
|
||||
@ -88,12 +88,10 @@ static void open_inode_done(OpenInode *of) {
|
||||
of->path = mfree(of->path);
|
||||
}
|
||||
xattr_done_many(of->xattr, of->n_xattr);
|
||||
#if HAVE_ACL
|
||||
if (of->acl_access)
|
||||
sym_acl_free(of->acl_access);
|
||||
if (of->acl_default)
|
||||
sym_acl_free(of->acl_default);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void open_inode_done_many(OpenInode *array, size_t n) {
|
||||
@ -115,22 +113,14 @@ static int open_inode_apply_acl(OpenInode *of) {
|
||||
return 0;
|
||||
|
||||
if (of->acl_access) {
|
||||
#if HAVE_ACL
|
||||
if (sym_acl_set_fd(of->fd, of->acl_access) < 0)
|
||||
RET_GATHER(r, log_error_errno(errno, "Failed to adjust ACLs of '%s': %m", of->path));
|
||||
#else
|
||||
log_debug("The archive entry '%s' has ACLs, but ACL support is disabled.", of->path);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (of->filetype == S_IFDIR && of->acl_default) {
|
||||
#if HAVE_ACL
|
||||
/* There's no API to set default ACLs by fd, hence go by /proc/self/fd/ path */
|
||||
if (sym_acl_set_file(FORMAT_PROC_FD_PATH(of->fd), ACL_TYPE_DEFAULT, of->acl_default) < 0)
|
||||
RET_GATHER(r, log_error_errno(errno, "Failed to adjust default ACLs of '%s': %m", of->path));
|
||||
#else
|
||||
log_debug("The archive entry '%s' has default ACLs, but ACL support is disabled.", of->path);
|
||||
#endif
|
||||
}
|
||||
|
||||
return r;
|
||||
@ -454,7 +444,6 @@ static int archive_entry_read_acl(
|
||||
return 0;
|
||||
assert(c > 0);
|
||||
|
||||
#if HAVE_ACL
|
||||
r = dlopen_libacl();
|
||||
if (r < 0) {
|
||||
log_debug_errno(r, "Not restoring ACL data on inode as libacl is not available: %m");
|
||||
@ -465,7 +454,6 @@ static int archive_entry_read_acl(
|
||||
a = sym_acl_init(c);
|
||||
if (!a)
|
||||
return log_oom();
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
int rtype, permset, tag, qual;
|
||||
@ -485,6 +473,10 @@ static int archive_entry_read_acl(
|
||||
|
||||
assert(rtype == type);
|
||||
|
||||
acl_entry_t e;
|
||||
if (sym_acl_create_entry(&a, &e) < 0)
|
||||
return log_error_errno(errno, "Failed to create ACL entry: %m");
|
||||
|
||||
static const struct {
|
||||
int libarchive;
|
||||
acl_tag_t libacl;
|
||||
@ -506,8 +498,9 @@ static int archive_entry_read_acl(
|
||||
if (ntag == ACL_UNDEFINED_TAG)
|
||||
continue;
|
||||
|
||||
#if HAVE_ACL
|
||||
acl_entry_t e;
|
||||
if (sym_acl_set_tag_type(e, ntag) < 0)
|
||||
return log_error_errno(errno, "Failed to set ACL entry tag: %m");
|
||||
|
||||
if (IN_SET(ntag, ACL_USER, ACL_GROUP)) {
|
||||
id_t id = qual;
|
||||
/* Suppress ACL entries for invalid UIDs/GIDS */
|
||||
@ -518,20 +511,8 @@ static int archive_entry_read_acl(
|
||||
if (FLAGS_SET(flags, TAR_SQUASH_UIDS_ABOVE_64K) && id >= NSRESOURCE_UIDS_64K)
|
||||
continue;
|
||||
|
||||
if (sym_acl_create_entry(&a, &e) < 0)
|
||||
return log_error_errno(errno, "Failed to create ACL entry: %m");
|
||||
|
||||
if (sym_acl_set_tag_type(e, ntag) < 0)
|
||||
return log_error_errno(errno, "Failed to set ACL entry tag: %m");
|
||||
|
||||
if (sym_acl_set_qualifier(e, &id) < 0)
|
||||
return log_error_errno(errno, "Failed to set ACL entry qualifier: %m");
|
||||
} else {
|
||||
if (sym_acl_create_entry(&a, &e) < 0)
|
||||
return log_error_errno(errno, "Failed to create ACL entry: %m");
|
||||
|
||||
if (sym_acl_set_tag_type(e, ntag) < 0)
|
||||
return log_error_errno(errno, "Failed to set ACL entry tag: %m");
|
||||
}
|
||||
|
||||
acl_permset_t p;
|
||||
@ -552,19 +533,11 @@ static int archive_entry_read_acl(
|
||||
|
||||
if (sym_acl_set_permset(e, p) < 0)
|
||||
return log_error_errno(errno, "Failed to set ACL entry permission set: %m");
|
||||
#else
|
||||
*acl = POINTER_MAX; /* Indicate the entry has valid ACLs. */
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAVE_ACL
|
||||
if (*acl)
|
||||
sym_acl_free(*acl);
|
||||
*acl = TAKE_PTR(a);
|
||||
#else
|
||||
*acl = NULL; /* Indicate the entry has no ACL. */
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -830,10 +803,7 @@ int tar_x(int input_fd, int tree_fd, TarFlags flags) {
|
||||
gid_t gid = GID_INVALID;
|
||||
struct timespec mtime = { .tv_nsec = UTIME_OMIT };
|
||||
unsigned fflags = 0;
|
||||
#if HAVE_ACL
|
||||
_cleanup_(acl_freep)
|
||||
#endif
|
||||
acl_t acl_access = NULL, acl_default = NULL;
|
||||
_cleanup_(acl_freep) acl_t acl_access = NULL, acl_default = NULL;
|
||||
XAttr *xa = NULL;
|
||||
size_t n_xa = 0;
|
||||
CLEANUP_ARRAY(xa, n_xa, xattr_done_many);
|
||||
@ -1149,7 +1119,6 @@ static int archive_generate_sparse(struct archive_entry *entry, int fd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if HAVE_ACL
|
||||
static int archive_write_acl(
|
||||
struct archive_entry *entry,
|
||||
acl_type_t ntype,
|
||||
@ -1239,7 +1208,6 @@ static int archive_write_acl(
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int archive_item(
|
||||
RecurseDirEvent event,
|
||||
@ -1325,7 +1293,6 @@ static int archive_item(
|
||||
sym_archive_entry_set_symlink(entry, s);
|
||||
}
|
||||
|
||||
#if HAVE_ACL
|
||||
if (inode_type_can_acl(sx->stx_mode)) {
|
||||
|
||||
r = dlopen_libacl();
|
||||
@ -1355,7 +1322,6 @@ static int archive_item(
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
_cleanup_free_ char *xattrs = NULL;
|
||||
r = flistxattr_malloc(inode_fd, &xattrs);
|
||||
|
||||
@ -51,12 +51,14 @@ static int builtin_net_setup_link(UdevEvent *event, int argc, char **argv) {
|
||||
return log_device_warning_errno(dev, r, "Failed to get link information: %m");
|
||||
|
||||
r = link_get_config(ctx, link);
|
||||
if (r < 0) {
|
||||
if (r == -ENOENT) {
|
||||
log_device_debug_errno(dev, r, "No matching link configuration found, ignoring device.");
|
||||
return 0;
|
||||
}
|
||||
if (r < 0)
|
||||
|
||||
return log_device_error_errno(dev, r, "Failed to get link config: %m");
|
||||
}
|
||||
|
||||
r = link_apply_config(ctx, link);
|
||||
if (r == -ENODEV)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user