On 03/14/2010 06:16 PM, Bruno Haible wrote:
> The reason is that unlink("..") returns 0 without having done any side effects
> on the file system. Likewise for unlink("../..").
> 
> Test program:
> ========================= foo.c ========================
> #include <errno.h>
> #include <stdio.h>
> #include <unistd.h>
> int main ()
> {
>   int ret = unlink ("../..");
>   printf ("%d %d\n", ret, errno);
>   return 0;
> }
> ========================================================
> 
> This prints
> -1 21 [EISDIR]
> on Linux, but
> 0 0
> on MacOS X.

Which version of MacOS X?  What does uname state?  What file system?

I cannot reproduce it on the machine I have access to, tested on an nfs
mount (where built) and hfs mount (/tmp):

$ uname -v
Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009;
root:xnu-1228.15.4~1/RELEASE_I386
$ ./foo
-1 1
$ cd /tmp
$ ~/foo
-1 16

The fact that it may be file-system dependent makes the fix trickier -
we now have to test hostname and assume that MacOS is broken, because it
is no longer possible to assume that the fs used during ./configure is
representative of other fs available on the system.

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to