Tweak the hostname-worldlist code (#43599)

This commit is contained in:
Yu Watanabe
2026-09-03 06:29:25 +09:00
committed by GitHub
6 changed files with 145 additions and 71 deletions
+7 -5
View File
@@ -790,7 +790,9 @@ int read_full_stream_full(
if (feof(f))
break;
if (size != SIZE_MAX && !FLAGS_SET(flags, READ_FULL_FILE_FAIL_WHEN_LARGER)) { /* If we got asked to read some specific size, we already sized the buffer right, hence leave */
if (size != SIZE_MAX && !FLAGS_SET(flags, READ_FULL_FILE_FAIL_WHEN_LARGER)) {
/* If we got asked to read some specific size, we already sized the buffer right,
* hence leave. */
assert(l == size);
break;
}
@@ -834,9 +836,9 @@ int read_full_stream_full(
}
if (!ret_size) {
/* Safety check: if the caller doesn't want to know the size of what we just read it will rely on the
* trailing NUL byte. But if there's an embedded NUL byte, then we should refuse operation as otherwise
* there'd be ambiguity about what we just read. */
/* Safety check: if the caller doesn't want to know the size of what we just read it will
* rely on the trailing NUL byte. But if there's an embedded NUL byte, then we should refuse
* operation as otherwise there'd be ambiguity about what we just read. */
if (memchr(buf, 0, l)) {
r = -EBADMSG;
@@ -1295,7 +1297,7 @@ static int search_and_fopen_internal(
assert(path);
assert(mode || !ret_file);
r = search_and_open(
r = search_and_open_internal(
path,
mode ? fopen_mode_to_flags(mode) : 0,
root,
+8 -8
View File
@@ -264,20 +264,20 @@ char** path_strv_resolve(char **l, const char *root) {
if (strv_isempty(l))
return l;
/* Goes through every item in the string list and canonicalize
* the path. This works in place and won't rollback any
* changes on failure. */
/* Go through every item in the string list and canonicalize the path.
* This works in place and doesn't roll back any changes on failure. */
STRV_FOREACH(s, l) {
_cleanup_free_ char *orig = NULL;
char *t, *u;
if (!path_is_absolute(*s)) {
free(*s);
continue;
}
if (root) {
if (!path_is_absolute(*s)) {
log_debug("Ignoring non-absolute search path '%s'.", *s);
free(*s);
continue;
}
orig = *s;
t = path_join(root, orig);
if (!t) {