Hello, dnie...@gmail.com, le dim. 19 janv. 2025 23:50:10 +0000, a ecrit: > diff --git a/procfs/netfs.c b/procfs/netfs.c > index 4ed5eab6..3cf7a8e2 100644 > --- a/procfs/netfs.c > +++ b/procfs/netfs.c > @@ -115,6 +115,29 @@ error_t netfs_attempt_readlink (struct iouser *user, > struct node *np, > return 0; > } > > +static unsigned char entry_type(char *name) > +{ > + char c; > + int only_numbers; > + > + if (name[0] == '.' && name[1] == 0) > + return DT_DIR; > + > + if (name[0] == '.' && name[1] == '.' && name[2] == 0) > + return DT_DIR; > + > + if (strcmp(name, "self") == 0) > + return DT_DIR; > + > + for(only_numbers = 1, c = *name; only_numbers && c; c = *++name) > + { > + if (c < '0' || c > '9') > + only_numbers = 0; > + }
This is quite fragile indeed, and will fail for subdirectories. It'd be better to call procfs_lookup to get the actual node and get its inode type. That'll be much less expensive than applications using stat() to get it, which will require RPC etc. Samuel