"Tom G. Christensen" <t...@jupiterrise.com> writes:

> depbase=`echo flock.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
>         gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" 
> -DNO_XMALLOC -DEXEEXT=\"\" -I. -I..  -I../intl -D_REENTRANT  -g -O2 -MT 
> flock.o -MD -MP -MF $depbase.Tpo -c -o flock.o flock.c &&\
>         mv -f $depbase.Tpo $depbase.Po
> flock.c: In function 'flock':
> flock.c:186: warning: implicit declaration of function 'memset'
> flock.c:186: warning: incompatible implicit declaration of built-in function 
> 'memset'
> flock.c:202: error: 'errno' undeclared (first use in this function)
> flock.c:202: error: (Each undeclared identifier is reported only once
> flock.c:202: error: for each function it appears in.)
> flock.c:202: error: 'EINVAL' undeclared (first use in this function)
> flock.c:207: error: 'EACCES' undeclared (first use in this function)
> flock.c:208: error: 'EAGAIN' undeclared (first use in this function)
> make[2]: *** [flock.o] Error 1
>
> Adding #include <errno.h> takes care of this error.

This one also seems simple.  Patch below.  Will push unless there are
objections.

> test-flock then fails like this:
> $ ./test-flock
> test-flock.c:72: assertion failed, errno = 22
> Abort (core dumped)

This suggests a deeper problem.  Unless someone debugs this, maybe at
least having it build will be good enough for some projects.

Thanks,
/Simon

2008-12-18  Simon Josefsson  <si...@josefsson.org>

        * lib/flock.c: Need to include errno.h.  Reported by "Tom
        G. Christensen" <t...@jupiterrise.com>.

diff --git a/lib/flock.c b/lib/flock.c
index 5aa7690..4db5004 100644
--- a/lib/flock.c
+++ b/lib/flock.c
@@ -171,6 +171,8 @@ flock (int fd, int operation)
 #include <unistd.h>
 #endif
 
+#include <errno.h>
+
 int
 flock (int fd, int operation)
 {


Reply via email to