Skip to content

Commit 2e7dcbf

Browse files
committed
Fix flock_compat layer
1 parent b13c975 commit 2e7dcbf

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

ext/spl/spl_directory.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,13 +2493,6 @@ PHP_METHOD(SplFileObject, getCsvControl)
24932493
}
24942494
/* }}} */
24952495

2496-
/* Because apparently it doesn't want to pull them from flock_compat.h for some stupid reason */
2497-
#define LOCK_SH 1
2498-
#define LOCK_EX 2
2499-
#define LOCK_NB 4
2500-
#define LOCK_UN 8
2501-
2502-
25032496
static int flock_values[] = { LOCK_SH, LOCK_EX, LOCK_UN };
25042497

25052498
/* {{{ Portable file locking, copy pasted from ext/standard/file.c flock() function.

ext/standard/flock_compat.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@
1818
#include <errno.h>
1919
#include "ext/standard/flock_compat.h"
2020

21-
#if HAVE_STRUCT_FLOCK
22-
#include <unistd.h>
23-
#include <fcntl.h>
24-
#include <sys/file.h>
25-
#endif
26-
27-
#ifdef PHP_WIN32
28-
#include <io.h>
29-
#include "config.w32.h"
30-
#endif
31-
3221
#ifndef HAVE_FLOCK
3322
PHPAPI int flock(int fd, int operation)
3423
{

ext/standard/flock_compat.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
#ifndef FLOCK_COMPAT_H
1818
#define FLOCK_COMPAT_H
1919

20+
#if HAVE_STRUCT_FLOCK
21+
#include <unistd.h>
22+
#include <fcntl.h>
23+
#include <sys/file.h>
24+
#endif
25+
26+
#ifdef PHP_WIN32
27+
#include <io.h>
28+
#include "config.w32.h"
29+
#endif
30+
2031
/* php_flock internally uses fcntl whether or not flock is available
2132
* This way our php_flock even works on NFS files.
2233
* More info: /usr/src/linux/Documentation

0 commit comments

Comments
 (0)