[Libsysio-commit] HEAD: libsysio/src chdir.c
Brought to you by:
lward
From: jaschut <ja...@us...> - 2003-10-27 23:43:12
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv19199 Modified Files: chdir.c Log Message: Remove the inop_getattr() call, which is redundant since _sysio_p_validate() should be checking the inode mode bits, and we can use them to test if the node is a directory. Index: chdir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/chdir.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- chdir.c 24 Oct 2003 17:59:18 -0000 1.9 +++ chdir.c 27 Oct 2003 23:42:29 -0000 1.10 @@ -89,28 +89,17 @@ int _sysio_p_chdir(struct pnode *pno) { int err; - struct intnl_stat stbuf; /* - * Revalidate + * Revalidate the pnode, and ensure it's a directory */ err = _sysio_p_validate(pno, NULL, NULL); if (err) return err; - if (!pno->p_base->pb_ino) - return -ENOTDIR; - /* - * Stat the node and ensure it's a directory. - */ - err = - pno->p_base->pb_ino->i_ops.inop_getattr(pno, - NULL, - &stbuf); - if (err) - return err; - if (!S_ISDIR(stbuf.st_mode)) - return -ENOTDIR; + if (!(pno->p_base->pb_ino && + S_ISDIR(pno->p_base->pb_ino->i_mode))) + return -ENOTDIR; /* * Release old if set. */ |