summaryrefslogtreecommitdiff
path: root/xcache
diff options
context:
space:
mode:
authorXuefer <xuefer@gmail.com>2013-09-09 11:34:16 +0000
committerXuefer <xuefer@gmail.com>2013-09-09 11:34:16 +0000
commitca6276ae08f402dbf29bb563f621db5cef73692b (patch)
tree0ef7c3983471a0a34f16314975e44825ccb31c5a /xcache
parent4f282ad3d555a9bf8510931afc53ddff10a47736 (diff)
downloadxcache-ca6276ae08f402dbf29bb563f621db5cef73692b.tar.gz
xcache-ca6276ae08f402dbf29bb563f621db5cef73692b.zip
cygwin hack unlink should be cygwin only
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1363 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
Diffstat (limited to 'xcache')
-rw-r--r--xcache/xc_lock.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/xcache/xc_lock.c b/xcache/xc_lock.c
index 4a9266e..f72440d 100644
--- a/xcache/xc_lock.c
+++ b/xcache/xc_lock.c
@@ -66,7 +66,10 @@ typedef int HANDLE;
typedef struct {
HANDLE fd;
+#ifdef __CYGWIN__
+ /* store the path for unlink() later */
char *pathname;
+#endif
} xc_fcntl_lock_t;
#ifndef ZEND_WIN32
@@ -149,13 +152,14 @@ static zend_bool xc_fcntl_init(xc_fcntl_lock_t *lck, const char *pathname) /* {{
if (fd != INVALID_HANDLE_VALUE) {
-#ifndef __CYGWIN__
- unlink(pathname);
-#endif
lck->fd = fd;
+#ifdef __CYGWIN__
size = strlen(pathname) + 1;
lck->pathname = malloc(size);
memcpy(lck->pathname, pathname, size);
+#else
+ unlink(pathname);
+#endif
}
else {
zend_error(E_ERROR, "xc_fcntl_create: open(%s, O_RDWR|O_CREAT, 0666) failed:", pathname);
@@ -174,8 +178,8 @@ static void xc_fcntl_destroy(xc_fcntl_lock_t *lck) /* {{{ */
close(lck->fd);
#ifdef __CYGWIN__
unlink(lck->pathname);
-#endif
free(lck->pathname);
+#endif
}
/* }}} */
static void xc_fcntl_lock(xc_fcntl_lock_t *lck) /* {{{ */