Module Name:    src
Committed By:   pooka
Date:           Fri Feb 18 14:33:11 UTC 2011

Modified Files:
        src/lib/librumphijack: hijack.c

Log Message:
fix rename


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/lib/librumphijack/hijack.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.51 src/lib/librumphijack/hijack.c:1.52
--- src/lib/librumphijack/hijack.c:1.51	Fri Feb 18 14:25:04 2011
+++ src/lib/librumphijack/hijack.c	Fri Feb 18 14:33:11 2011
@@ -1,4 +1,4 @@
-/*      $NetBSD: hijack.c,v 1.51 2011/02/18 14:25:04 pooka Exp $	*/
+/*      $NetBSD: hijack.c,v 1.52 2011/02/18 14:33:11 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: hijack.c,v 1.51 2011/02/18 14:25:04 pooka Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.52 2011/02/18 14:33:11 pooka Exp $");
 
 #define __ssp_weak_name(fun) _hijack_ ## fun
 
@@ -689,6 +689,25 @@
 	return rv;
 }
 
+int
+rename(const char *from, const char *to)
+{
+	int (*op_rename)(const char *, const char *);
+
+	if (path_isrump(from)) {
+		if (!path_isrump(to))
+			return EXDEV;
+
+		from = path_host2rump(from);
+		to = path_host2rump(to);
+		op_rename = GETSYSCALL(rump, RENAME);
+	} else {
+		op_rename = GETSYSCALL(host, RENAME);
+	}
+
+	return op_rename(from, to);
+}
+
 int __socket30(int, int, int);
 int
 __socket30(int domain, int type, int protocol)
@@ -1618,12 +1637,6 @@
 	(const char *, char *, size_t),					\
 	(path, buf, bufsiz))
 
-/* XXX: cross-kernel renames need to be blocked */
-PATHCALL(int, rename, DUALCALL_RENAME,					\
-	(const char *path, const char *to),				\
-	(const char *, const char *),					\
-	(path, to))
-
 PATHCALL(int, mkdir, DUALCALL_MKDIR,					\
 	(const char *path, mode_t mode),				\
 	(const char *, mode_t),						\

Reply via email to