[Libsysio-commit] HEAD: libsysio/src rename.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2003-10-13 21:23:48
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv10077/src Modified Files: rename.c Log Message: Crafted new test for rename call. Fixed a few bugs in rename: Path node parent at root is NULL, not a cycle. Check for cross device renames, not simple cross mount. Check to make sure that that the source is not covered and that neither the source nor the destination is a mountpoint. Index: rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rename.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- rename.c 27 Sep 2003 19:42:03 -0000 1.1 +++ rename.c 13 Oct 2003 21:23:44 -0000 1.2 @@ -78,9 +78,15 @@ rename(const char *oldpath, const char * if (err && !new) goto error2; - if (old->p_mount->mnt_root != new->p_mount->mnt_root) { + if (old->p_mount->mnt_root == old || old->p_cover || + new->p_mount->mnt_root == new) { + err = -EBUSY; + goto error1; + } + + if (old->p_mount->mnt_fs != new->p_mount->mnt_fs) { /* - * Oops. They're trying to move it across mounts. + * Oops. They're trying to move it across file systems. */ err = -EXDEV; goto error1; @@ -99,7 +105,7 @@ rename(const char *oldpath, const char * err = -EINVAL; goto error1; } - } while (pb != nxtpb); + } while (nxtpb); while (new->p_base->pb_ino) { /* @@ -134,6 +140,7 @@ rename(const char *oldpath, const char * err = -EEXIST; goto error1; } + break; } /* |