summaryrefslogtreecommitdiff
path: root/src/user/lib/fs
diff options
context:
space:
mode:
authordzwdz2022-08-01 21:35:03 +0200
committerdzwdz2022-08-01 21:35:03 +0200
commit5fc7009037e392ccec021b1251ddfff9a8604368 (patch)
tree7a18ffeae1a3842ca6d57c7d83a45654fa7cc17d /src/user/lib/fs
parente9a64093e2187fa858a0bf792d11cb5e7c67064d (diff)
fix some sign comparision warnings
Diffstat (limited to 'src/user/lib/fs')
-rw-r--r--src/user/lib/fs/dir.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/user/lib/fs/dir.c b/src/user/lib/fs/dir.c
index 0529bfe..35028bd 100644
--- a/src/user/lib/fs/dir.c
+++ b/src/user/lib/fs/dir.c
@@ -1,5 +1,6 @@
#include <camellia/syscalls.h>
#include <errno.h>
+#include <limits.h>
#include <string.h>
#include <user/lib/fs/dir.h>
@@ -20,10 +21,14 @@ bool dir_append(struct dirbuild *db, const char *name) {
bool dir_appendl(struct dirbuild *db, const char *name, size_t len) {
if (db->error) return true;
+ if (len > (size_t)LONG_MAX) {
+ db->error = -1;
+ return true;
+ }
len++; // account for the null byte
- if (db->offset < len) {
+ if (db->offset < (long)len) {
name += db->offset;
len -= db->offset;
db->offset = 0;