shared: treat generator units as vendor units
Units created with "systemctl edit --full" from generator units aren't removed with "systemctl revert" because units in the generator, generator_early, and generator_late paths aren't considered vendor units. Alter path_is_vendor() to return true if the given path is a generator unit, which in turn causes "systemctl revert" to remove units created with "systemctl edit --full" as they now have vendor versions. Fixes #10053
This commit is contained in:
parent
9b3278d907
commit
efdbf5fe9c
|
@ -227,7 +227,7 @@ static int path_is_runtime(const LookupPaths *p, const char *path, bool check_pa
|
||||||
path_equal_ptr(path, p->runtime_control);
|
path_equal_ptr(path, p->runtime_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int path_is_vendor(const LookupPaths *p, const char *path) {
|
static int path_is_vendor_or_generator(const LookupPaths *p, const char *path) {
|
||||||
const char *rpath;
|
const char *rpath;
|
||||||
|
|
||||||
assert(p);
|
assert(p);
|
||||||
|
@ -245,6 +245,9 @@ static int path_is_vendor(const LookupPaths *p, const char *path) {
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (path_is_generator(p, rpath))
|
||||||
|
return true;
|
||||||
|
|
||||||
return path_equal(rpath, SYSTEM_DATA_UNIT_PATH);
|
return path_equal(rpath, SYSTEM_DATA_UNIT_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2374,7 +2377,7 @@ int unit_file_revert(
|
||||||
return -errno;
|
return -errno;
|
||||||
} else if (S_ISREG(st.st_mode)) {
|
} else if (S_ISREG(st.st_mode)) {
|
||||||
/* Check if there's a vendor version */
|
/* Check if there's a vendor version */
|
||||||
r = path_is_vendor(&paths, path);
|
r = path_is_vendor_or_generator(&paths, path);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
if (r > 0)
|
if (r > 0)
|
||||||
|
|
Loading…
Reference in New Issue