On Monday 25 July 2005 10:05 pm, Matt Kraai wrote:
> On Mon, Jul 25, 2005 at 04:40:03PM -0700, Bruce Korb wrote:
> > I have an image up on Source Forge:
> > 
> >   http://autogen.sf.net/data/autogen-5.7.2-semifinal.tar.gz
> > 
> > If it makes you-all happy, then I will release exactly  that image.
> 
> I have two minor nits:
> 
> 1. After it calls canonicalize_file_name, shouldn't optionMakePath
> check that the length of the result is less than bufSize instead of
> less than MAXPATHLEN?

It is filling in a buffer passed by address and that buffer is
(and already was) guaranteed to be MAXPATHLEN+1 bytes long.
Since the buffer size is not also passed, the function must
rely on the caller providing a buffer of that size.  (It is
internal and not callable by library users.)

> 2. Since realpath expects a buffer of size PATH_MAX, if PATH_MAX isn't
> defined, shouldn't realpath not be used at all?

realpath(3C) should not be implemented without PATH_MAX defined,
so I think you are right.  That should probably be done in libc,
but I should guard against it, too.  So I have.  In configure.in:

> AC_DEFUN([AG_RUN_REALPATH],[
>   AC_MSG_CHECKING([whether we have a functional realpath(3C)])
>   AC_CACHE_VAL([ag_cv_run_realpath],[
>   AC_TRY_RUN([EMAIL PROTECTED]:@include <limits.h>
> @%:@include <stdlib.h>
> int main (int argc, char** argv) {
> @%:@ifndef PATH_MAX
> choke me!!
> @%:@else
>    char zPath@<:@PATH_MAX+1@:>@;
> @%:@endif
>    char *pz = realpath(argv@<:@0@:>@, zPath);
>    return (pz == zPath) ? 0 : 1;
> }],
>     [ag_cv_run_realpath=yes],[ag_cv_run_realpath=no],[ag_cv_run_realpath=no]
>   ) # end of TRY_RUN
>   ]) # end of AC_CACHE_VAL for ag_cv_run_realpath
>   AC_MSG_RESULT([${ag_cv_run_realpath}])
> 
>   if test "X${ag_cv_run_realpath}" != Xno
>   then
>     AC_DEFINE([HAVE_REALPATH],[1],
>         [Define this if we have a functional realpath(3C)])
>   fi
>   
> ]) # end of AC_DEFUN of AG_RUN_REALPATH


Thanks - Bruce


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to