mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
swap: don't add mount links for swap devices
This commit is contained in:
parent
d4e6a6f66b
commit
8407a5d018
3
swap.c
3
swap.c
@ -70,6 +70,9 @@ int swap_add_one_mount_link(Swap *s, Mount *m) {
|
||||
m->meta.load_state != UNIT_LOADED)
|
||||
return 0;
|
||||
|
||||
if (is_device_path(s->what))
|
||||
return 0;
|
||||
|
||||
if (!path_startswith(s->what, m->where))
|
||||
return 0;
|
||||
|
||||
|
2
unit.c
2
unit.c
@ -1864,7 +1864,7 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) {
|
||||
|
||||
/* Adds in links to the device node that this unit is based on */
|
||||
|
||||
if (!path_startswith(what, "/dev/") && !path_startswith(what, "/sys/"))
|
||||
if (!is_device_path(what))
|
||||
return 0;
|
||||
|
||||
if (!(e = unit_name_build_escape(what+1, NULL, ".device")))
|
||||
|
10
util.c
10
util.c
@ -1927,6 +1927,16 @@ bool is_clean_exit(int code, int status) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_device_path(const char *path) {
|
||||
|
||||
/* Returns true on paths that refer to a device, either in
|
||||
* sysfs or in /dev */
|
||||
|
||||
return
|
||||
path_startswith(path, "/dev/") ||
|
||||
path_startswith(path, "/sys/");
|
||||
}
|
||||
|
||||
static const char *const ioprio_class_table[] = {
|
||||
[IOPRIO_CLASS_NONE] = "none",
|
||||
[IOPRIO_CLASS_RT] = "realtime",
|
||||
|
Loading…
Reference in New Issue
Block a user