summaryrefslogtreecommitdiff
path: root/src/user/bootstrap/tar.c
diff options
context:
space:
mode:
authordzwdz2022-08-07 00:04:54 +0200
committerdzwdz2022-08-07 00:04:54 +0200
commit93ce4f4248999adeb85c6859dc2b5c54d7a8d7b7 (patch)
treed2ed20a632cdaf782facce76c870413a47c3f60e /src/user/bootstrap/tar.c
parent809f9a9899b219e33ec839b3f9bee644fcfecacc (diff)
user/libc: strchr
Diffstat (limited to 'src/user/bootstrap/tar.c')
-rw-r--r--src/user/bootstrap/tar.c9
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;
}
}