remove() problem fixed
Marcin Cieslak
saper at SYSTEM.PL
Sun Sep 10 05:56:25 PDT 2006
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 at 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);
}
More information about the freebsd-emulation
mailing list