Thread: Fix for compile error clog.c

Fix for compile error clog.c

From
Rene Pijlman
Date:
I'm getting a compile error in src/backend/access/transam in
current CVS:

gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations
-I../../../../src/include   -c -o clog.o clog.c
clog.c: In function `CLOGPhysicalReadPage':
clog.c:542: `S_IRUSR' undeclared (first use in this function)
clog.c:542: (Each undeclared identifier is reported only once
clog.c:542: for each function it appears in.)
clog.c:542: `S_IWUSR' undeclared (first use in this function)
clog.c: In function `CLOGPhysicalWritePage':
clog.c:593: `S_IRUSR' undeclared (first use in this function)
clog.c:593: `S_IWUSR' undeclared (first use in this function)
make: *** [clog.o] Error 1

The manual page open(2) on my Red Hat Linux 7.1 box says:

  SYNOPSIS
       #include <sys/types.h>
       #include <sys/stat.h>
       #include <fcntl.h>

       int open(const char *pathname, int flags);

clog.c includes only <fcntl.h>. And indeed, when I add the
includes <sys/types.h> and <sys/stat.h> it compiles fine. So it
seems clog.c is just missing a few includes.

Attached is a patch to fix this problem. I see the same includes
in other files (e.g. xlog.c), so I assume this is portable.

Regards,
René Pijlman

Attachment

Re: Fix for compile error clog.c

From
Tom Lane
Date:
Rene Pijlman <rpijlman@wanadoo.nl> writes:
> clog.c includes only <fcntl.h>. And indeed, when I add the
> includes <sys/types.h> and <sys/stat.h> it compiles fine.

Thanks.  It compiled okay here, but evidently the location of
those symbols isn't too standardized.  Will fix.

            regards, tom lane