src: changed usage of basename() to path_extract_filename().
TODO.
This commit is contained in:
committed by
Luca Boccassi
parent
ee9fc74a4c
commit
de2820606d
+13
-4
@@ -71,10 +71,11 @@ int unit_symlink_name_compatible(const char *symlink, const char *target, bool i
|
||||
}
|
||||
|
||||
int unit_validate_alias_symlink_or_warn(int log_level, const char *filename, const char *target) {
|
||||
const char *src, *dst;
|
||||
_cleanup_free_ char *src = NULL, *dst = NULL;
|
||||
_cleanup_free_ char *src_instance = NULL, *dst_instance = NULL;
|
||||
UnitType src_unit_type, dst_unit_type;
|
||||
UnitNameFlags src_name_type, dst_name_type;
|
||||
int r;
|
||||
|
||||
/* Check if the *alias* symlink is valid. This applies to symlinks like
|
||||
* /etc/systemd/system/dbus.service → dbus-broker.service, but not to .wants or .requires symlinks
|
||||
@@ -87,8 +88,13 @@ int unit_validate_alias_symlink_or_warn(int log_level, const char *filename, con
|
||||
* -ELOOP for an alias to self.
|
||||
*/
|
||||
|
||||
src = basename(filename);
|
||||
dst = basename(target);
|
||||
r = path_extract_filename(filename, &src);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = path_extract_filename(target, &dst);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* src checks */
|
||||
|
||||
@@ -762,7 +768,10 @@ int unit_file_find_fragment(
|
||||
}
|
||||
|
||||
if (fragment && ret_names) {
|
||||
const char *fragment_basename = basename(fragment);
|
||||
_cleanup_free_ char *fragment_basename = NULL;
|
||||
r = path_extract_filename(fragment, &fragment_basename);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!streq(fragment_basename, unit_name)) {
|
||||
/* Add names based on the fragment name to the set of names */
|
||||
|
||||
Reference in New Issue
Block a user