[Libsysio-commit] HEAD: libsysio/src mount.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2008-04-23 00:23:26
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11187/src Modified Files: mount.c Log Message: In _sysio_do_mount we now test to ensure that everything is a directory that we can. Also, got rid of _sysio_p_gone use in that routine. Would like to get it everywhere, restricting it to the inode.c file only. Someday... Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -w -b -B -p -r1.28 -r1.29 --- mount.c 22 Apr 2008 22:02:49 -0000 1.28 +++ mount.c 23 Apr 2008 00:23:21 -0000 1.29 @@ -123,6 +123,15 @@ _sysio_do_mount(struct filesys *fs, int err; /* + * Directories only, please. + */ + if ((tocover && + !(tocover->p_base->pb_ino && + S_ISDIR(tocover->p_base->pb_ino->i_stbuf.st_mode))) || + !rootpb->pb_ino || !S_ISDIR(rootpb->pb_ino->i_stbuf.st_mode)) + return -ENOTDIR; + + /* * It's really poor form to allow the new root to be a * descendant of the pnode being covered. */ @@ -167,13 +176,6 @@ _sysio_do_mount(struct filesys *fs, goto error; } /* - * It better be a directory! - */ - if (!S_ISDIR(mnt->mnt_root->p_base->pb_ino->i_stbuf.st_mode)) { - err = -ENOTDIR; - goto error; - } - /* * Cover up the mount point. */ mnt->mnt_covers = tocover; @@ -195,10 +197,6 @@ _sysio_do_mount(struct filesys *fs, return 0; error: - if (mnt->mnt_root) { - P_RELE(mnt->mnt_root); - _sysio_p_gone(mnt->mnt_root); - } free(mnt); return err; } |