mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-07 17:17:44 +03:00
analyze: basename() → path_extract_filename()
This commit is contained in:
parent
d0242ac946
commit
020b66d850
@ -36,12 +36,9 @@ static void log_syntax_callback(const char *unit, int level, void *userdata) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int verify_prepare_filename(const char *filename, char **ret) {
|
int verify_prepare_filename(const char *filename, char **ret) {
|
||||||
int r;
|
_cleanup_free_ char *abspath = NULL, *name = NULL, *dir = NULL, *with_instance = NULL;
|
||||||
const char *name;
|
|
||||||
_cleanup_free_ char *abspath = NULL;
|
|
||||||
_cleanup_free_ char *dir = NULL;
|
|
||||||
_cleanup_free_ char *with_instance = NULL;
|
|
||||||
char *c;
|
char *c;
|
||||||
|
int r;
|
||||||
|
|
||||||
assert(filename);
|
assert(filename);
|
||||||
assert(ret);
|
assert(ret);
|
||||||
@ -50,7 +47,10 @@ int verify_prepare_filename(const char *filename, char **ret) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
name = basename(abspath);
|
r = path_extract_filename(abspath, &name);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
if (!unit_name_is_valid(name, UNIT_NAME_ANY))
|
if (!unit_name_is_valid(name, UNIT_NAME_ANY))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user