mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-12 09:17:44 +03:00
commit
476f65f98a
@ -735,6 +735,7 @@ static int mount_entry_chase(
|
||||
|
||||
char *chased;
|
||||
int r;
|
||||
unsigned flags = 0;
|
||||
|
||||
assert(m);
|
||||
|
||||
@ -742,9 +743,19 @@ static int mount_entry_chase(
|
||||
* chase the symlinks on our own first. This is called for the destination path, as well as the source path (if
|
||||
* that applies). The result is stored in "location". */
|
||||
|
||||
r = chase_symlinks(path, root_directory,
|
||||
IN_SET(m->mode, BIND_MOUNT, BIND_MOUNT_RECURSIVE, PRIVATE_TMP, PRIVATE_VAR_TMP, PRIVATE_DEV, BIND_DEV, EMPTY_DIR, SYSFS, PROCFS) ? CHASE_NONEXISTENT : 0,
|
||||
&chased);
|
||||
if (IN_SET(m->mode,
|
||||
BIND_MOUNT,
|
||||
BIND_MOUNT_RECURSIVE,
|
||||
PRIVATE_TMP,
|
||||
PRIVATE_VAR_TMP,
|
||||
PRIVATE_DEV,
|
||||
BIND_DEV,
|
||||
EMPTY_DIR,
|
||||
SYSFS,
|
||||
PROCFS))
|
||||
flags |= CHASE_NONEXISTENT;
|
||||
|
||||
r = chase_symlinks(path, root_directory, flags, &chased);
|
||||
if (r == -ENOENT && m->ignore) {
|
||||
log_debug_errno(r, "Path %s does not exist, ignoring.", path);
|
||||
return 0;
|
||||
|
@ -771,8 +771,6 @@ static int client_parse_message(
|
||||
size_t pos = 0;
|
||||
int r;
|
||||
bool clientid = false;
|
||||
uint8_t *id = NULL;
|
||||
size_t id_len;
|
||||
uint32_t lt_t1 = ~0, lt_t2 = ~0;
|
||||
|
||||
assert(client);
|
||||
@ -817,8 +815,8 @@ static int client_parse_message(
|
||||
break;
|
||||
|
||||
case SD_DHCP6_OPTION_SERVERID:
|
||||
r = dhcp6_lease_get_serverid(lease, &id, &id_len);
|
||||
if (r >= 0 && id) {
|
||||
r = dhcp6_lease_get_serverid(lease, NULL, NULL);
|
||||
if (r >= 0) {
|
||||
log_dhcp6_client(client, "%s contains multiple serverids",
|
||||
dhcp6_message_type_to_string(message->type));
|
||||
return -EINVAL;
|
||||
@ -956,21 +954,23 @@ static int client_parse_message(
|
||||
}
|
||||
|
||||
if (client->state != DHCP6_STATE_INFORMATION_REQUEST) {
|
||||
r = dhcp6_lease_get_serverid(lease, &id, &id_len);
|
||||
if (r < 0)
|
||||
r = dhcp6_lease_get_serverid(lease, NULL, NULL);
|
||||
if (r < 0) {
|
||||
log_dhcp6_client(client, "%s has no server id",
|
||||
dhcp6_message_type_to_string(message->type));
|
||||
return r;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (lease->ia.addresses) {
|
||||
lease->ia.ia_na.lifetime_t1 = htobe32(lt_t1);
|
||||
lease->ia.ia_na.lifetime_t2 = htobe32(lt_t2);
|
||||
}
|
||||
} else {
|
||||
if (lease->ia.addresses) {
|
||||
lease->ia.ia_na.lifetime_t1 = htobe32(lt_t1);
|
||||
lease->ia.ia_na.lifetime_t2 = htobe32(lt_t2);
|
||||
}
|
||||
|
||||
if (lease->pd.addresses) {
|
||||
lease->pd.ia_pd.lifetime_t1 = htobe32(lt_t1);
|
||||
lease->pd.ia_pd.lifetime_t2 = htobe32(lt_t2);
|
||||
if (lease->pd.addresses) {
|
||||
lease->pd.ia_pd.lifetime_t1 = htobe32(lt_t1);
|
||||
lease->pd.ia_pd.lifetime_t2 = htobe32(lt_t2);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -95,11 +95,14 @@ int dhcp6_lease_set_serverid(sd_dhcp6_lease *lease, const uint8_t *id,
|
||||
|
||||
int dhcp6_lease_get_serverid(sd_dhcp6_lease *lease, uint8_t **id, size_t *len) {
|
||||
assert_return(lease, -EINVAL);
|
||||
assert_return(id, -EINVAL);
|
||||
assert_return(len, -EINVAL);
|
||||
|
||||
*id = lease->serverid;
|
||||
*len = lease->serverid_len;
|
||||
if (!lease->serverid)
|
||||
return -ENOMSG;
|
||||
|
||||
if (id)
|
||||
*id = lease->serverid;
|
||||
if (len)
|
||||
*len = lease->serverid_len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2233,10 +2233,8 @@ static int chase_symlinks_and_update(char **p, unsigned flags) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to resolve path %s: %m", *p);
|
||||
|
||||
free(*p);
|
||||
*p = chased;
|
||||
|
||||
return 0;
|
||||
free_and_replace(*p, chased);
|
||||
return r; /* r might be an fd here in case we ever use CHASE_OPEN in flags */
|
||||
}
|
||||
|
||||
static int determine_uid_shift(const char *directory) {
|
||||
|
@ -42,7 +42,7 @@ static int exec_list(struct udev_enumerate *udev_enumerate, const char *action,
|
||||
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(udev_enumerate)) {
|
||||
char filename[UTIL_PATH_SIZE];
|
||||
const char *syspath;
|
||||
int fd;
|
||||
_cleanup_close_ int fd = -1;
|
||||
|
||||
syspath = udev_list_entry_get_name(entry);
|
||||
if (verbose)
|
||||
@ -54,14 +54,15 @@ static int exec_list(struct udev_enumerate *udev_enumerate, const char *action,
|
||||
fd = open(filename, O_WRONLY|O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
continue;
|
||||
|
||||
if (settle_set) {
|
||||
r = set_put_strdup(settle_set, syspath);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
if (write(fd, action, strlen(action)) < 0)
|
||||
log_debug_errno(errno, "error writing '%s' to '%s': %m", action, filename);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user