mirror of
https://github.com/systemd/systemd.git
synced 2025-02-24 17:57:34 +03:00
tree-wide: trivial tweaks
This commit is contained in:
parent
9c18b36372
commit
39e419a2b5
@ -1055,7 +1055,7 @@ int path_extract_filename(const char *path, char **ret) {
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
*ret = TAKE_PTR(a);
|
*ret = TAKE_PTR(a);
|
||||||
return strlen(c) > (size_t)r ? O_DIRECTORY : 0;
|
return strlen(c) > (size_t) r ? O_DIRECTORY : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int path_extract_directory(const char *path, char **ret) {
|
int path_extract_directory(const char *path, char **ret) {
|
||||||
@ -1109,7 +1109,7 @@ bool filename_is_valid(const char *p) {
|
|||||||
if (isempty(p))
|
if (isempty(p))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (dot_or_dot_dot(p))
|
if (dot_or_dot_dot(p)) /* Yes, in this context we consider "." and ".." invalid */
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
e = strchrnul(p, '/');
|
e = strchrnul(p, '/');
|
||||||
|
@ -161,10 +161,10 @@ int path_extract_directory(const char *path, char **ret);
|
|||||||
bool filename_is_valid(const char *p) _pure_;
|
bool filename_is_valid(const char *p) _pure_;
|
||||||
bool path_is_valid_full(const char *p, bool accept_dot_dot) _pure_;
|
bool path_is_valid_full(const char *p, bool accept_dot_dot) _pure_;
|
||||||
static inline bool path_is_valid(const char *p) {
|
static inline bool path_is_valid(const char *p) {
|
||||||
return path_is_valid_full(p, true);
|
return path_is_valid_full(p, /* accept_dot_dot= */ true);
|
||||||
}
|
}
|
||||||
static inline bool path_is_safe(const char *p) {
|
static inline bool path_is_safe(const char *p) {
|
||||||
return path_is_valid_full(p, false);
|
return path_is_valid_full(p, /* accept_dot_dot= */ false);
|
||||||
}
|
}
|
||||||
bool path_is_normalized(const char *p) _pure_;
|
bool path_is_normalized(const char *p) _pure_;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user