holm@ubc-bdcvax.UUCP (Terrence W. Holm) (02/10/89)
EFTH MINIX report #67 - February 1989 - fs/path.c fix The routine last_dir() in fs/path.c allows creat(2) to work in a directory that is not connected to the rest of the file tree. For example, try: mkdir z cd z sh cd .. rmdir z ^D cat >a This happened to me when I escaped out of mined (^S) and, forgetting I was still in the editor, moved the current directory somewhere else. When I was surprised by my entry back into mined (by a ^D) some hours later, I wrote out the data (^W^X), and signed off. Later in the week fsck bitched about some blocks not being marked free. Using de(1) I checked to see what the problem was; I recognized the block contents, and traced down the problem. I have solved this situation by making sure that creat(2)'s (and mknod(2)'s) only occur in directories that have at least one link to them. See line 10722 in the text for the location of the change. People doing work on fs should make sure I have not damaged anything. BTW, "The Fly II" opens tonight. The newborn baby at the beginning is my nephew. Terrence W. Holm holm@bdc.ubc.ca ---------------------------------------------------------- *** path.c.1.3x Wed Jan 18 21:58:21 1989 --- path.c Sun Feb 5 20:47:22 1989 *************** *** 71,76 **** --- 71,82 ---- /* Is the path absolute or relative? Initialize 'rip' accordingly. */ rip = (*path == '/' ? fp->fp_rootdir : fp->fp_workdir); + + if ( rip->i_nlinks == 0 ) { + err_code = ENOENT; + return(NIL_INODE); + } + dup_inode(rip); /* inode will be returned with put_inode */ /* Scan the path component by component. */ ----------------------------------------------------------