On Sun, Jan 26 2014, David Bremner <david@tethera.net> wrote: > Tomi Ollila <tomi.ollila@iki.fi> writes: >> +#if POSIX_2008_REALPATH >> filename = realpath (config->filename, NULL); >> +#else >> + /* compatibility with minor effort, not elegance, is the ruling factor >> + in these (two) else branches... */ >> + char resolved_path[PATH_MAX]; >> + filename = realpath (config->filename, resolved_path); >> +#endif > > I worry a bit about making the mainline code messier and harder to maintain, in order to > accomodate an unknown number of targets without POSIX2008 realpath. Do > we know how widespread this problem is? Is it just NetBSD? > > I looked at borrowing realpath from gnulib; it looks like it would be a > bit of work as the least complicated version includes 3 other include > files. But then the mainline code could be blisfully ignorant of the > whole dispute. We could also create char * realpath2008 (const char * path, char * resolved_path) { if (resolved_path == NULL) { resolved_path = malloc (MAX_PATH); if (resolved_path == NULL) return NULL; } return realpath (path, resolved_path); } And, in the case where NULL argument is accepted, #define realpath2008(path, resolved_path) realpath(path, resolved_path) (or an inline function to do the same) In this case one is not totally ignorant to the whole dispute -- but on the other hand, developer should be savvy about the potential issues using realpath() function, and this might just ring the bell... > d Tomi