mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-01 17:40:14 +01:00
systemd: merge branch systemd into master
This commit is contained in:
commit
4f9a7f883e
4 changed files with 19 additions and 19 deletions
|
|
@ -945,7 +945,7 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags,
|
|||
/* Preserve the trailing slash */
|
||||
|
||||
if (flags & CHASE_TRAIL_SLASH)
|
||||
if (!strextend(&done, "/", NULL))
|
||||
if (!strextend(&done, "/"))
|
||||
return -ENOMEM;
|
||||
|
||||
break;
|
||||
|
|
@ -1016,7 +1016,7 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags,
|
|||
if (streq_ptr(done, "/"))
|
||||
*done = '\0';
|
||||
|
||||
if (!strextend(&done, first, todo, NULL))
|
||||
if (!strextend(&done, first, todo))
|
||||
return -ENOMEM;
|
||||
|
||||
exists = false;
|
||||
|
|
@ -1109,7 +1109,7 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags,
|
|||
if (streq(done, "/"))
|
||||
*done = '\0';
|
||||
|
||||
if (!strextend(&done, first, NULL))
|
||||
if (!strextend(&done, first))
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -231,13 +231,12 @@ int fd_is_network_fs(int fd) {
|
|||
}
|
||||
|
||||
int path_is_temporary_fs(const char *path) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
struct statfs s;
|
||||
|
||||
fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_PATH);
|
||||
if (fd < 0)
|
||||
if (statfs(path, &s) < 0)
|
||||
return -errno;
|
||||
|
||||
return fd_is_temporary_fs(fd);
|
||||
return is_temporary_fs(&s);
|
||||
}
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
|
|
|
|||
|
|
@ -798,10 +798,10 @@ char *strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
|
|||
return *ibuf;
|
||||
}
|
||||
|
||||
char *strextend_with_separator(char **x, const char *separator, ...) {
|
||||
bool need_separator;
|
||||
char *strextend_with_separator_internal(char **x, const char *separator, ...) {
|
||||
size_t f, l, l_separator;
|
||||
char *r, *p;
|
||||
bool need_separator;
|
||||
char *nr, *p;
|
||||
va_list ap;
|
||||
|
||||
assert(x);
|
||||
|
|
@ -825,7 +825,7 @@ char *strextend_with_separator(char **x, const char *separator, ...) {
|
|||
if (need_separator)
|
||||
n += l_separator;
|
||||
|
||||
if (n > ((size_t) -1) - l) {
|
||||
if (n >= SIZE_MAX - l) {
|
||||
va_end(ap);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -837,11 +837,12 @@ char *strextend_with_separator(char **x, const char *separator, ...) {
|
|||
|
||||
need_separator = !isempty(*x);
|
||||
|
||||
r = realloc(*x, l+1);
|
||||
if (!r)
|
||||
nr = realloc(*x, GREEDY_ALLOC_ROUND_UP(l+1));
|
||||
if (!nr)
|
||||
return NULL;
|
||||
|
||||
p = r + f;
|
||||
*x = nr;
|
||||
p = nr + f;
|
||||
|
||||
va_start(ap, separator);
|
||||
for (;;) {
|
||||
|
|
@ -860,12 +861,11 @@ char *strextend_with_separator(char **x, const char *separator, ...) {
|
|||
}
|
||||
va_end(ap);
|
||||
|
||||
assert(p == r + l);
|
||||
assert(p == nr + l);
|
||||
|
||||
*p = 0;
|
||||
*x = r;
|
||||
|
||||
return r + l;
|
||||
return p;
|
||||
}
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
|
|
|
|||
|
|
@ -189,9 +189,10 @@ char *strreplace(const char *text, const char *old_string, const char *new_strin
|
|||
|
||||
char *strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]);
|
||||
|
||||
char *strextend_with_separator(char **x, const char *separator, ...) _sentinel_;
|
||||
char *strextend_with_separator_internal(char **x, const char *separator, ...) _sentinel_;
|
||||
|
||||
#define strextend(x, ...) strextend_with_separator(x, NULL, __VA_ARGS__)
|
||||
#define strextend_with_separator(x, separator, ...) strextend_with_separator_internal(x, separator, __VA_ARGS__, NULL)
|
||||
#define strextend(x, ...) strextend_with_separator_internal(x, NULL, __VA_ARGS__, NULL)
|
||||
|
||||
char *strrep(const char *s, unsigned n);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue