From owner-freebsd-java Fri Jun 2 9:40:53 2000 Delivered-To: freebsd-java@freebsd.org Received: from ares.trc.adelaide.edu.au (ares.trc.adelaide.edu.au [129.127.246.5]) by hub.freebsd.org (Postfix) with ESMTP id 3CB8437BA67 for ; Fri, 2 Jun 2000 09:40:49 -0700 (PDT) (envelope-from glewis@ares.trc.adelaide.edu.au) Received: (from glewis@localhost) by ares.trc.adelaide.edu.au (8.9.3/8.9.3) id CAA31260; Sat, 3 Jun 2000 02:10:39 +0930 (CST) (envelope-from glewis) From: Greg Lewis Message-Id: <200006021640.CAA31260@ares.trc.adelaide.edu.au> Subject: Re: can't remove directories? In-Reply-To: <200006021630.CAA22648@ares.trc.adelaide.edu.au> from Greg Lewis at "Jun 3, 2000 02:00:04 am" To: Greg Lewis Date: Sat, 3 Jun 2000 02:10:39 +0930 (CST) Cc: Rob Furphy , freebsd-java@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL70 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Greg Lewis wrote: [a buggered up patch. Note to self: No more late night hacking!] Right, that will teach me to add a comment after I compiled something. The last patch was missing the closing */ on the second comment. So here is what the patch should look like, and this one will compile. Index: src/freebsd/native/java/io/UnixFileSystem_md.c =================================================================== RCS file: /data/java/JDK2/javasrc/src/freebsd/native/java/io/UnixFileSystem_md.c,v retrieving revision 1.3 diff -u -r1.3 UnixFileSystem_md.c --- src/freebsd/native/java/io/UnixFileSystem_md.c 2000/04/13 14:05:57 1.3 +++ src/freebsd/native/java/io/UnixFileSystem_md.c 2000/06/02 16:37:00 @@ -237,7 +237,17 @@ jboolean rv = JNI_FALSE; WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) { +#ifdef __FreeBSD__ + /* + * Under FreeBSD remove(3) is simply an alias for unlink(2). This + * is not the case on Linux and Solaris where remove() calls unlink() + * for files and rmdir() for directories. Duplicate this functionality + * here by trying rmdir should unlink fail. + */ + if (unlink(path) == 0 || rmdir(path) == 0) { +#else if (remove(path) == 0) { +#endif rv = JNI_TRUE; } } END_PLATFORM_STRING(env, path); @@ -250,7 +260,18 @@ jobject file) { WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) { +#ifdef __FreeBSD__ + /* + * Under FreeBSD remove(3) is simply an alias for unlink(2). This + * is not the case on Linux and Solaris where remove() calls unlink() + * for files and rmdir() for directories. Duplicate this functionality + * here by trying rmdir should unlink fail. + */ + deleteOnExit(env, path, unlink); + deleteOnExit(env, path, rmdir); +#else deleteOnExit(env, path, remove); +#endif } END_PLATFORM_STRING(env, path); return JNI_TRUE; } -- Greg Lewis glewis@trc.adelaide.edu.au Computing Officer +61 8 8303 5083 Teletraffic Research Centre To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message