Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/librumphijack fix rename



details:   https://anonhg.NetBSD.org/src/rev/0f04f23f18eb
branches:  trunk
changeset: 762266:0f04f23f18eb
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Feb 18 14:33:11 2011 +0000

description:
fix rename

diffstat:

 lib/librumphijack/hijack.c |  29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diffs (57 lines):

diff -r 31b98f6ec866 -r 0f04f23f18eb lib/librumphijack/hijack.c
--- a/lib/librumphijack/hijack.c        Fri Feb 18 14:26:52 2011 +0000
+++ b/lib/librumphijack/hijack.c        Fri Feb 18 14:33:11 2011 +0000
@@ -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),                                         \



Home | Main Index | Thread Index | Old Index