Re: Netsurf build failure: 'PATH_MAX' undeclared
João Pedro Malhado, le lun. 26 avril 2021 12:51:34 +0200, a ecrit:
> On Mon, Apr 26, 2021 at 12:40:25PM +0200, João Pedro Malhado wrote:
> > I made some simple changes to the time.c file and the build went on, only to
> > fail at some later stage. The error that I'm getting is:
> > frontends/gtk/fetch.c: In function 'nsgtk_get_resource_url':
> > frontends/gtk/fetch.c:252:11: error: 'PATH_MAX' undeclared (first use in this
> > function)
> > 252 | char buf[PATH_MAX];
> > Now, the only C I know is what I can guess from other programming languages I'm
> > familiar with, but this seems simple and not very hurd specific. However the
> > build does not seem to have any problems on other platforms, so I don't know.
> > Anyone has an idea on how to best approach this?
> It does seem this is a documented issue:
> What would be a reasonable approach here, change to use _POSIX_PATH_MAX?
See what the page says:
Note: constants such as _POSIX_PATH_MAX are only the minimum required
value for a potential corresponding PATH_MAX macro. They are not a
replacement for PATH_MAX, just the minimum value that one can assume.
What would be best suited completely depends on what the buf purpose is
at all, whether the size is actually known and just needs to be
computed, or else use dynamic allocation. I'm here basically just
rephrasing the page...