[Libsysio-commit] HEAD: libsysio/src namei.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2006-02-08 17:17:51
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3483/src Modified Files: namei.c Log Message: The startup code in the tests directory should process the namespace initialization variable before the initial working directory. Fixed. From ClusterFS bugzilla #10114; When compiled to support an initial working directory that is deferred until needed, a chdir to a non-existent directory would cause an abort. This behavior is per design. Not technically a bug. However, it's very unfriendly. Especially so, since the accepted thing to do in this situation is to just leave the current working directory at the root of the namespace. This change, then, alters the behavior to the commonly accepted. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- namei.c 15 Sep 2005 19:29:02 -0000 1.18 +++ namei.c 8 Feb 2006 17:17:43 -0000 1.19 @@ -186,19 +186,22 @@ _sysio_path_walk(struct pnode *parent, s if (!parent) { const char *icwd; - if (!_sysio_init_cwd) + if (!_sysio_init_cwd && !nd->nd_root) abort(); /* - * Finally have to set the curretn working directory. We can + * Finally have to set the current working directory. We can * not tolerate errors here or else risk leaving the process * in a very unexpected location. We abort then unless all goes * well. */ icwd = _sysio_init_cwd; _sysio_init_cwd = NULL; - if (_sysio_namei(NULL, icwd, 0, NULL, &parent) != 0 || - _sysio_p_chdir(parent) != 0) + parent = nd->nd_root; + if (!parent) + abort(); + (void )_sysio_namei(nd->nd_root, icwd, 0, NULL, &parent); + if (_sysio_p_chdir(parent) != 0) abort(); } #endif |