[Libsysio-commit] HEAD: libsysio/src rename.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2007-03-15 02:53:38
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv19858/src Modified Files: rename.c Log Message: Fixed a bug in rename, reported by Cray (SPR 737687), when a file is renamed to a hard link of itself. I.e.: link old, new rename old, new The rename function was not releasing the pnodes when it detected the source and target were the same. Index: rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rename.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- rename.c 25 Jan 2005 18:56:15 -0000 1.11 +++ rename.c 15 Mar 2007 02:53:34 -0000 1.12 @@ -127,7 +127,7 @@ SYSIO_INTERFACE_NAME(rename)(const char * If old == new, we're done. */ if (old->p_base->pb_ino == new->p_base->pb_ino) - goto out; + goto short_out; if (new->p_base->pb_ino) { /* @@ -175,8 +175,10 @@ SYSIO_INTERFACE_NAME(rename)(const char if (new->p_base->pb_ino) I_GONE(new->p_base->pb_ino); new->p_base->pb_ino = old->p_base->pb_ino; + old->p_base->pb_ino = NULL; I_REF(new->p_base->pb_ino); +short_out: error1: P_RELE(new); error2: @@ -184,7 +186,6 @@ error2: error3: if (err) goto out; - _sysio_p_gone(old); /* kill it! */ out: SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); } |