Browse Source

Merge pull request #1031 from trapexit/root-parent

Return ENOENT when dotdot for root node requested
pull/1032/head 2.33.5
trapexit 2 years ago
committed by GitHub
parent
commit
d9ab18282f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      libfuse/lib/fuse.c

12
libfuse/lib/fuse.c

@ -2037,11 +2037,11 @@ fuse_lib_lookup(fuse_req_t req,
uint64_t parent, uint64_t parent,
const char *name) const char *name)
{ {
struct fuse *f = req_fuse_prepare(req);
struct fuse_entry_param e;
char *path;
int err; int err;
char *path;
struct node *dot = NULL; struct node *dot = NULL;
struct fuse *f = req_fuse_prepare(req);
struct fuse_entry_param e = {0};
if(name[0] == '.') if(name[0] == '.')
{ {
@ -2061,6 +2061,12 @@ fuse_lib_lookup(fuse_req_t req,
} }
else if((name[1] == '.') && (name[2] == '\0')) else if((name[1] == '.') && (name[2] == '\0'))
{ {
if(parent == 1)
{
reply_entry(req,&e,-ENOENT);
return;
}
name = NULL; name = NULL;
pthread_mutex_lock(&f->lock); pthread_mutex_lock(&f->lock);
parent = get_node(f,parent)->parent->nodeid; parent = get_node(f,parent)->parent->nodeid;

Loading…
Cancel
Save