Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!shamash!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: the file with the empty name "" Message-ID: <15196@mimsy.UUCP> Date: 30 Dec 88 01:19:44 GMT References: <2294@bucsb.UUCP> <659@sbsvax.UUCP> <1847@piraat.cs.vu.nl> <662@sbsvax.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 37 In article <662@sbsvax.UUCP> greim@sbsvax.UUCP (Michael Greim) writes: >If you do something like 'open ("", 1)', how can you tell what really >happens (short of looking in the kernel text)? You cannot. All you can tell are the effects. To test that it opens the current directory, rather than the first file in the current directory (which is normally `.', and hence just another name for the current directory) you would have to arrange to find a directory without `.' as the first element. This is somewhat difficult, and can cause the kernel to deadlock or panic in some Unixes, but is not impossible. If you manage it, you will find that 4BSD kernels treat open("" as open the current working directory. Of course, it is simpler to just peek at ufs_namei.c (in 4.3BSD-tahoe) and find the following: /* * Check for degenerate name (e.g. / or "") * which is a way of talking about a directory, * e.g. like "/." or ".". */ if (ndp->ni_dent.d_name[0] == '\0') { if (flag != LOOKUP || lockparent) { u.u_error = EISDIR; goto bad; } FREE(nbp, M_NAMEI); return (dp); } -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris