From 363d1373f4856ba5621668e3676eea3dd3b3a734 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 5 Sep 2007 18:16:32 +0000 Subject: [PATCH] We need to use _kern_open() on BeOS incompatible systems, if we want to be able to open symlinks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22182 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/unzip/beos.c | 6 ++++++ src/tools/unzip/unix/unxcfg.h | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bin/unzip/beos.c b/src/bin/unzip/beos.c index 28c66eb7a9..94e9f4551a 100644 --- a/src/bin/unzip/beos.c +++ b/src/bin/unzip/beos.c @@ -1107,10 +1107,16 @@ static int set_file_attrs( const char *name, ptr = (unsigned char *)attr_buff; guard = ptr + attr_size; +#ifdef HAIKU_USE_KERN_OPEN + fd = _kern_open( -1, name, O_RDONLY | O_NOTRAVERSE, 0 ); + if( fd < 0 ) + return fd; +#else fd = open( name, O_RDONLY | O_NOTRAVERSE ); if( fd < 0 ) { return errno; /* should it be -fd ? */ } +#endif while( ptr < guard ) { ssize_t wrote_bytes; diff --git a/src/tools/unzip/unix/unxcfg.h b/src/tools/unzip/unix/unxcfg.h index 6c231d41c3..33047c20d7 100644 --- a/src/tools/unzip/unix/unxcfg.h +++ b/src/tools/unzip/unix/unxcfg.h @@ -28,4 +28,8 @@ # ifndef EOK # define EOK B_OK # endif -#endif // __BEOS__ + +# define HAIKU_USE_KERN_OPEN 1 +extern int _kern_open(int fd, const char *path, int openMode, int perms); + +#endif // !__BEOS__