mirror of
https://github.com/systemd/systemd
synced 2026-03-17 18:44:46 +01:00
Compare commits
No commits in common. "357f5b07ae79ba55ea91c01412e9c98279231327" and "3fe398cec036ac810344b5b13b07cddcca1acd49" have entirely different histories.
357f5b07ae
...
3fe398cec0
@ -528,9 +528,6 @@ int unit_name_from_path(const char *path, const char *suffix, char **ret) {
|
||||
if (!s)
|
||||
return -ENOMEM;
|
||||
|
||||
if (strlen(s) >= UNIT_NAME_MAX) /* Return a slightly more descriptive error for this specific condition */
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
/* Refuse this if this got too long or for some other reason didn't result in a valid name */
|
||||
if (!unit_name_is_valid(s, UNIT_NAME_PLAIN))
|
||||
return -EINVAL;
|
||||
@ -562,9 +559,6 @@ int unit_name_from_path_instance(const char *prefix, const char *path, const cha
|
||||
if (!s)
|
||||
return -ENOMEM;
|
||||
|
||||
if (strlen(s) >= UNIT_NAME_MAX) /* Return a slightly more descriptive error for this specific condition */
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
/* Refuse this if this got too long or for some other reason didn't result in a valid name */
|
||||
if (!unit_name_is_valid(s, UNIT_NAME_INSTANCE))
|
||||
return -EINVAL;
|
||||
|
||||
@ -1713,18 +1713,11 @@ static int mount_setup_unit(
|
||||
.burst = 1,
|
||||
};
|
||||
|
||||
if (r == -ENAMETOOLONG)
|
||||
return log_struct_errno(
|
||||
ratelimit_below(&rate_limit) ? LOG_WARNING : LOG_DEBUG, r,
|
||||
"MESSAGE_ID=" SD_MESSAGE_MOUNT_POINT_PATH_NOT_SUITABLE_STR,
|
||||
"MOUNT_POINT=%s", where,
|
||||
LOG_MESSAGE("Mount point path '%s' too long to fit into unit name, ignoring mount point.", where));
|
||||
|
||||
return log_struct_errno(
|
||||
ratelimit_below(&rate_limit) ? LOG_WARNING : LOG_DEBUG, r,
|
||||
"MESSAGE_ID=" SD_MESSAGE_MOUNT_POINT_PATH_NOT_SUITABLE_STR,
|
||||
"MOUNT_POINT=%s", where,
|
||||
LOG_MESSAGE("Failed to generate valid unit name from mount point path '%s', ignoring mount point: %m", where));
|
||||
LOG_MESSAGE("Failed to generate valid unit name from path '%s', ignoring mount point: %m", where));
|
||||
}
|
||||
|
||||
u = manager_get_unit(m, e);
|
||||
|
||||
@ -1448,9 +1448,6 @@ int swap_process_device_new(Manager *m, sd_device *dev) {
|
||||
int q;
|
||||
|
||||
q = unit_name_from_path(devlink, ".swap", &n);
|
||||
if (IN_SET(q, -EINVAL, -ENAMETOOLONG)) /* If name too long or otherwise not convertible to
|
||||
* unit name, we can't manage it */
|
||||
continue;
|
||||
if (q < 0)
|
||||
return q;
|
||||
|
||||
|
||||
@ -1473,17 +1473,16 @@ static int unit_add_mount_dependencies(Unit *u) {
|
||||
Unit *m;
|
||||
|
||||
r = unit_name_from_path(prefix, ".mount", &p);
|
||||
if (IN_SET(r, -EINVAL, -ENAMETOOLONG))
|
||||
continue; /* If the path cannot be converted to a mount unit name, then it's
|
||||
* not managable as a unit by systemd, and hence we don't need a
|
||||
* dependency on it. Let's thus silently ignore the issue. */
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
m = manager_get_unit(u->manager, p);
|
||||
if (!m) {
|
||||
/* Make sure to load the mount unit if it exists. If so the dependencies on
|
||||
* this unit will be added later during the loading of the mount unit. */
|
||||
/* Make sure to load the mount unit if
|
||||
* it exists. If so the dependencies
|
||||
* on this unit will be added later
|
||||
* during the loading of the mount
|
||||
* unit. */
|
||||
(void) manager_load_unit_prepare(u->manager, p, NULL, NULL, &m);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ static void cryptsetup_log_glue(int level, const char *msg, void *usrptr) {
|
||||
}
|
||||
|
||||
void cryptsetup_enable_logging(struct crypt_device *cd) {
|
||||
/* It's OK to call this with a NULL parameter, in which case libcryptsetup will set the default log
|
||||
/* It's OK to call this with a NULL parameter, in which case libcryptsetup will set the defaut log
|
||||
* function.
|
||||
*
|
||||
* Note that this is also called from dlopen_cryptsetup(), which we call here too. Sounds like an
|
||||
|
||||
@ -130,7 +130,7 @@ static void test_unit_name_from_path(void) {
|
||||
test_unit_name_from_path_one("///", ".mount", "-.mount", 0);
|
||||
test_unit_name_from_path_one("/foo/../bar", ".mount", NULL, -EINVAL);
|
||||
test_unit_name_from_path_one("/foo/./bar", ".mount", "foo-bar.mount", 0);
|
||||
test_unit_name_from_path_one("/waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", ".mount", NULL, -ENAMETOOLONG);
|
||||
test_unit_name_from_path_one("/waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", ".mount", NULL, -EINVAL);
|
||||
}
|
||||
|
||||
static void test_unit_name_from_path_instance_one(const char *pattern, const char *path, const char *suffix, const char *expected, int ret) {
|
||||
@ -160,7 +160,7 @@ static void test_unit_name_from_path_instance(void) {
|
||||
test_unit_name_from_path_instance_one("waldo", "..", ".mount", NULL, -EINVAL);
|
||||
test_unit_name_from_path_instance_one("waldo", "/foo", ".waldi", NULL, -EINVAL);
|
||||
test_unit_name_from_path_instance_one("wa--ldo", "/--", ".mount", "wa--ldo@\\x2d\\x2d.mount", 0);
|
||||
test_unit_name_from_path_instance_one("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "/waldo", ".mount", NULL, -ENAMETOOLONG);
|
||||
test_unit_name_from_path_instance_one("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "/waldo", ".mount", NULL, -EINVAL);
|
||||
}
|
||||
|
||||
static void test_unit_name_to_path_one(const char *unit, const char *path, int ret) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user