Skip to content

Commit 538f710

Browse files
author
Hubert Badocha
committed
rofs: handle empty string in lookup
JIRA: RTOS-927
1 parent 1533188 commit 538f710

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

rofs/rofs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ int rofs_lookup(struct rofs_ctx *ctx, oid_t *dir, const char *name, oid_t *fil,
436436
struct rofs_node *node = NULL;
437437
int parent_id = 0;
438438
int len = 0;
439-
int res;
439+
int res = -ENOENT;
440440

441441
fil->port = ctx->oid.port;
442442
if (name == NULL) {
@@ -448,7 +448,7 @@ int rofs_lookup(struct rofs_ctx *ctx, oid_t *dir, const char *name, oid_t *fil,
448448
}
449449

450450
while (name[len] != '\0') {
451-
while (name[len] == '/' && name[len] != '\0') {
451+
while (name[len] == '/') {
452452
len++;
453453
}
454454

0 commit comments

Comments
 (0)