Date: Wed, 8 Nov 2006 18:44:42 -0500 From: Jung-uk Kim <jkim@FreeBSD.org> To: freebsd-emulation@FreeBSD.org Subject: [PATCH] fixes for LTP mknod01, mknod07 and mknod09 Message-ID: <200611081844.44550.jkim@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
--Boundary-00=_svmUFOyRrFvyJPN Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline The attached patch fixes LTP mknod01, mknod07 and mknod09. This is not a critical fix but it fixes a very annoying problem, i.e., LTP leaves a corrupt directory after each run. # rm -rf mknAawlFy rm: mknAawlFy/tnode: Bad file descriptor rm: mknAawlFy: Directory not empty # ls -al mknAawlFy ls: tnode: Bad file descriptor total 4 drwxrwxrwx 2 root wheel 512 11 7 17:06 . drwxrwxrwt 12 root wheel 512 11 8 18:41 .. Jung-uk Kim --Boundary-00=_svmUFOyRrFvyJPN Content-Type: text/x-diff; charset="iso-8859-1"; name="linux_misc.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="linux_misc.diff" --- src/sys/compat/linux/linux_misc.c.orig Tue Nov 7 17:46:33 2006 +++ src/sys/compat/linux/linux_misc.c Wed Nov 8 18:11:38 2006 @@ -890,11 +890,34 @@ printf(ARGS(mknod, "%s, %d, %d"), path, args->mode, args->dev); #endif - if (S_ISFIFO(args->mode)) + switch (args->mode & S_IFMT) { + case S_IFIFO: + case S_IFSOCK: error = kern_mkfifo(td, path, UIO_SYSSPACE, args->mode); - else + break; + + case S_IFCHR: + case S_IFBLK: error = kern_mknod(td, path, UIO_SYSSPACE, args->mode, args->dev); + break; + + case S_IFDIR: + error = EPERM; + break; + + case 0: + args->mode |= S_IFREG; + /* fall through */ + case S_IFREG: + error = kern_open(td, path, UIO_SYSSPACE, + O_WRONLY | O_CREAT | O_TRUNC, args->mode); + break; + + default: + error = EINVAL; + break; + } LFREEPATH(path); return (error); } --Boundary-00=_svmUFOyRrFvyJPN--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611081844.44550.jkim>