Date: Sun, 10 Sep 2006 14:56:08 +0200 From: Marcin Cieslak <saper@SYSTEM.PL> To: Alexander Leidinger <Alexander@Leidinger.net> Cc: emulation@freebsd.org Subject: remove() problem fixed Message-ID: <45040B68.8010302@SYSTEM.PL> In-Reply-To: <20060910144812.6933ffd1@Magellan.Leidinger.net> References: <20060910123402.000e1358@Magellan.Leidinger.net> <4503F8A2.1030104@SYSTEM.PL> <20060910144812.6933ffd1@Magellan.Leidinger.net>
next in thread | previous in thread | raw e-mail | index | archive | help
The fix for remove() was ... trivial. We need to introduce non POSIX
compliant behaviour of unlink(2). No idea why it worked, probably
libc checked for directory instead of the EISDIR error value.
Sorry for versioning crap, I am using my normal buildworld environment
stuff. Is there anyway I can make easily make diffs to p4 repo?
If not, I will have to go head and install whole CVS repository
to finally be able to "cvs diff"
Now unlink() gets EISDIR instead of EPERM and remove() is able
to recover.
--
<< Marcin Cieslak // saper@system.pl >>
--- linux_file.c Sun Sep 10 14:41:16 2006
+++ linux_file.c_new Sun Sep 10 14:36:08 2006
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/compat/linux/linux_file.c,v
1.91 2005/04/13 04:31:43 mdodd Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_file.c,v 1.91 2005/04/13
04:31:43 mdodd Exp $");
#include "opt_compat.h"
#include "opt_mac.h"
@@ -45,6 +45,7 @@
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/proc.h>
+#include <sys/stat.h>
#include <sys/syscallsubr.h>
#include <sys/sysproto.h>
#include <sys/tty.h>
@@ -502,6 +503,7 @@
{
char *path;
int error;
+ struct stat sbp;
LCONVPATHEXIST(td, args->path, &path);
@@ -511,6 +513,11 @@
#endif
error = kern_unlink(td, path, UIO_SYSSPACE);
+ if (error == EPERM)
+ /* Introduce POSIX noncompliant behaviour of Linux */
+ if (kern_stat(td, path, UIO_SYSSPACE, &sbp) == 0)
+ if (S_ISDIR(sbp.st_mode))
+ error = EISDIR;
LFREEPATH(path);
return (error);
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45040B68.8010302>
