X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Ffs%2Fubifs%2Fdir.c;fp=kernel%2Ffs%2Fubifs%2Fdir.c;h=f5d5ee43ae6eb775a59f0d2deee5ba907531f45a;hb=52f993b8e89487ec9ee15a7fb4979e0f09a45b27;hp=e49bd2808bf3e397b9b499fe4d6036ad7600a71b;hpb=c189ccac5702322ed843fe17057035b7222a59b6;p=kvmfornfv.git diff --git a/kernel/fs/ubifs/dir.c b/kernel/fs/ubifs/dir.c index e49bd2808..f5d5ee43a 100644 --- a/kernel/fs/ubifs/dir.c +++ b/kernel/fs/ubifs/dir.c @@ -350,7 +350,7 @@ static unsigned int vfs_dent_type(uint8_t type) */ static int ubifs_readdir(struct file *file, struct dir_context *ctx) { - int err; + int err = 0; struct qstr nm; union ubifs_key key; struct ubifs_dent_node *dent; @@ -452,14 +452,20 @@ out: kfree(file->private_data); file->private_data = NULL; - if (err != -ENOENT) { + if (err != -ENOENT) ubifs_err(c, "cannot find next direntry, error %d", err); - return err; - } + else + /* + * -ENOENT is a non-fatal error in this context, the TNC uses + * it to indicate that the cursor moved past the current directory + * and readdir() has to stop. + */ + err = 0; + /* 2 is a special value indicating that there are no more direntries */ ctx->pos = 2; - return 0; + return err; } /* Free saved readdir() state when the directory is closed */