You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Charles Randall <cr...@matchlogic.com> on 2000/02/17 12:38:29 UTC

2.0 build fails on src/support/rotatelogs.c on FreeBSD

Using FreeBSD 3.3-R and a fresh copy of the 2.0 src via rsync,

	% ./configure
	% make

results in,

--- snip ---
===> src/support
gcc -c  -I../os/unix -I../include -I../modules/mpm/prefork   -D_REENTRANT
-funsigned-char -I../lib/apr/include -DUSE_EXPAT -I../lib/expat-lite
`../apaci` rotatelogs.c
rotatelogs.c: In function `main':
rotatelogs.c:23: `MAX_PATH' undeclared (first use this function)
rotatelogs.c:23: (Each undeclared identifier is reported only once
rotatelogs.c:23: for each function it appears in.)
*** Error code 1
--- snip ---

POSIX defines a PATH_MAX. Is this a typo?

Even if it was a typo this code in rotatelogs.c should have worked, right?

#ifdef MAX_PATH
#undef MAX_PATH
#define MAX_PATH        1024
#endif

Can anyone repeat or explain this?

Applying the patch below worked for me.

-Charles

--- backup/rotatelogs.c Thu Feb 17 04:33:34 2000
+++ ./rotatelogs.c      Thu Feb 17 04:34:32 2000
@@ -8,9 +8,9 @@
 
 
 #define BUFSIZE                65536
-#ifdef MAX_PATH
-#undef MAX_PATH
-#define MAX_PATH       1024
+#ifdef PATH_MAX
+#undef PATH_MAX
+#define PATH_MAX       1024
 #endif
 
 #include "ap_config.h"
@@ -20,7 +20,7 @@
 
 void main (int argc, char **argv)
 {
-    char buf[BUFSIZE], buf2[MAX_PATH];
+    char buf[BUFSIZE], buf2[PATH_MAX];
     time_t tLogEnd = 0;
     time_t tRotation;
     int nLogFD = -1;

RE: 2.0 build fails on src/support/rotatelogs.c on FreeBSD

Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
> > Even if it was a typo this code in rotatelogs.c should have
> worked, right?
> >
> > #ifdef MAX_PATH
> > #undef MAX_PATH
> > #define MAX_PATH        1024
> > #endif
> >
> Errrr, I can explain it. I muffed it up! Apologies. Fixing it now...
>
> History of this change in case you are interested... MAX_PATH
> is defined by
> Windows to be 256. I wanted to override this value. I need to move the
> #endif right after the #undef MAX_PATH.
>
> Bill
>

Boy that code looked familiar!

Do Unixes define the constant _MAX_PATH (with leading underscore?) - I
noticed it in an MS standard library include.   Perhaps _MAX_PATH would be
more platform appropriate?  Or another name altogether (since in MS
parlance, MAX_PATH has a very, very specific meaning!)


Re: 2.0 build fails on src/support/rotatelogs.c on FreeBSD

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
> Even if it was a typo this code in rotatelogs.c should have worked, right?
>
> #ifdef MAX_PATH
> #undef MAX_PATH
> #define MAX_PATH        1024
> #endif
>
Errrr, I can explain it. I muffed it up! Apologies. Fixing it now...

History of this change in case you are interested... MAX_PATH is defined by
Windows to be 256. I wanted to override this value. I need to move the
#endif right after the #undef MAX_PATH.

Bill


Re: 2.0 build fails on src/support/rotatelogs.c on FreeBSD

Posted by rb...@apache.org.
The explanation is easy, rotatelogs was added to the build very recently,
and it hasn't really been tested yet.  It is not a typo, but we obviously
aren't including a header file that we need.  I'll look into soon, unless
somebody else wants to.  :-)

Ryan

On Thu, 17 Feb 2000, Charles Randall wrote:

> Using FreeBSD 3.3-R and a fresh copy of the 2.0 src via rsync,
> 
> 	% ./configure
> 	% make
> 
> results in,
> 
> --- snip ---
> ===> src/support
> gcc -c  -I../os/unix -I../include -I../modules/mpm/prefork   -D_REENTRANT
> -funsigned-char -I../lib/apr/include -DUSE_EXPAT -I../lib/expat-lite
> `../apaci` rotatelogs.c
> rotatelogs.c: In function `main':
> rotatelogs.c:23: `MAX_PATH' undeclared (first use this function)
> rotatelogs.c:23: (Each undeclared identifier is reported only once
> rotatelogs.c:23: for each function it appears in.)
> *** Error code 1
> --- snip ---
> 
> POSIX defines a PATH_MAX. Is this a typo?
> 
> Even if it was a typo this code in rotatelogs.c should have worked, right?
> 
> #ifdef MAX_PATH
> #undef MAX_PATH
> #define MAX_PATH        1024
> #endif
> 
> Can anyone repeat or explain this?
> 
> Applying the patch below worked for me.
> 
> -Charles
> 
> --- backup/rotatelogs.c Thu Feb 17 04:33:34 2000
> +++ ./rotatelogs.c      Thu Feb 17 04:34:32 2000
> @@ -8,9 +8,9 @@
>  
>  
>  #define BUFSIZE                65536
> -#ifdef MAX_PATH
> -#undef MAX_PATH
> -#define MAX_PATH       1024
> +#ifdef PATH_MAX
> +#undef PATH_MAX
> +#define PATH_MAX       1024
>  #endif
>  
>  #include "ap_config.h"
> @@ -20,7 +20,7 @@
>  
>  void main (int argc, char **argv)
>  {
> -    char buf[BUFSIZE], buf2[MAX_PATH];
> +    char buf[BUFSIZE], buf2[PATH_MAX];
>      time_t tLogEnd = 0;
>      time_t tRotation;
>      int nLogFD = -1;
> 


Come to the first official Apache Software Foundation
Conference!!!   <http://ApacheCon.Com/>

_______________________________________________________________________________
Ryan Bloom                        	rbb@ntrnet.net
2121 Stonehenge Dr. Apt #3
Raleigh, NC 27615		Ryan Bloom -- thinker, adventurer, artist,
				     writer, but mostly, friend.
-------------------------------------------------------------------------------