Control: tags -1 + patch

* Yaroslav Halchenko <deb...@onerussian.com>, 2012-07-30, 23:21:
x86_64-kfreebsd-gnu-gcc -Wall -g -O2 -I./src/include -Isrc/include -DHAVE_CONFIG_H 
-DLOCALEDIR=\"/usr/share/locale\" -c -o src/pv/cursor.o src/pv/cursor.c
src/pv/cursor.c: In function 'pv_crs__lock_lockfile':
src/pv/cursor.c:100:51: error: 'O_NOFOLLOW' undeclared (first use in this 
function)
src/pv/cursor.c:100:51: note: each undeclared identifier is reported only once 
for each function it appears in
make[1]: *** [src/pv/cursor.o] Error 1
make[1]: Leaving directory 
`/build/buildd-pv_1.2.0-1-kfreebsd-amd64-lcb9ew/pv-1.2.0'
make: *** [build-stamp] Error 2

The code seems to assume that if O_EXLOCK is defined then O_NOFOLLOW is also defined. This is not true on kFreeBSD by default: O_EXLOCK is defined, but O_NOFOLLOW is not (though it can be enabled by a feature test macro).

The attached patch fixes this problem.

--
Jakub Wilk
--- pv-1.2.0/src/pv/cursor.c	2010-12-14 11:06:01.000000000 +0100
+++ pv-1.2.0/src/pv/cursor.c	2012-08-09 22:55:19.000000000 +0200
@@ -63,7 +63,7 @@
  */
 static void pv_crs__lock_lockfile(int fd)
 {
-#ifdef O_EXLOCK
+#if defined(O_EXLOCK) && defined(O_NOFOLLOW)
 	char *ttydev;
 	char *tmpdir;
 #ifndef MAXPATHLEN
@@ -103,7 +103,7 @@
 		pv_crs__noipc = 1;
 #endif
 
-#else				/* !O_EXLOCK */
+#else				/* !O_EXLOCK || !O_NOFOLLOW */
 
 	pv_crs__uselockfile = 1;
 #ifdef HAVE_IPC

Reply via email to