tree-wide: trivial tweaks

This commit is contained in:
Lennart Poettering 2022-07-11 15:10:38 +02:00
parent 9c18b36372
commit 39e419a2b5
2 changed files with 4 additions and 4 deletions

View file

@ -1055,7 +1055,7 @@ int path_extract_filename(const char *path, char **ret) {
return -ENOMEM;
*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) {
@ -1109,7 +1109,7 @@ bool filename_is_valid(const char *p) {
if (isempty(p))
return false;
if (dot_or_dot_dot(p))
if (dot_or_dot_dot(p)) /* Yes, in this context we consider "." and ".." invalid */
return false;
e = strchrnul(p, '/');

View file

@ -161,10 +161,10 @@ int path_extract_directory(const char *path, char **ret);
bool filename_is_valid(const char *p) _pure_;
bool path_is_valid_full(const char *p, bool accept_dot_dot) _pure_;
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) {
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_;