diff options
author | dzwdz | 2022-08-07 00:04:54 +0200 |
---|---|---|
committer | dzwdz | 2022-08-07 00:04:54 +0200 |
commit | 93ce4f4248999adeb85c6859dc2b5c54d7a8d7b7 (patch) | |
tree | d2ed20a632cdaf782facce76c870413a47c3f60e /src/user/bootstrap | |
parent | 809f9a9899b219e33ec839b3f9bee644fcfecacc (diff) |
user/libc: strchr
Diffstat (limited to 'src/user/bootstrap')
-rw-r--r-- | src/user/bootstrap/tar.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/user/bootstrap/tar.c b/src/user/bootstrap/tar.c index 0356987..6bd4179 100644 --- a/src/user/bootstrap/tar.c +++ b/src/user/bootstrap/tar.c @@ -4,6 +4,7 @@ #include <camellia/syscalls.h> #include <shared/mem.h> #include <stdint.h> +#include <string.h> #include <unistd.h> #include <user/lib/fs/dir.h> @@ -94,12 +95,8 @@ static void tar_read(struct fs_wait_response *res, void *base, size_t base_len) char *suffix = base + off + meta_len; /* check if the path contains any non-trailing slashes */ - char *next = suffix; - // TODO strchr - while (*next && *next != '/') next++; - if (*next == '/') next++; - - if (*next == '\0') { + char *slash = strchr(suffix, '/'); + if (!slash || slash[1] == '\0') { if (dir_append(&db, suffix)) break; } } |