[rrd-developers] [PATCH] rrd_daemon: pay attention to the return value of realpath

Alex Bennee kernel-hacker at bennee.com
Mon Nov 15 17:18:17 CET 2010


Ooop, should of hit replay-all

---------- Forwarded message ----------

On 15 November 2010 15:51, kevin brintnall <kbrint at rufus.net> wrote:
> It looks like setting the 2nd arg of realpath() to NULL is not a portable
> way to cause it to be strdup()'ed.  i.e. on Solaris 2.8:
>      EINVAL
>            Either the file_name or resolved_name  argument  is  a
>            null pointer.
> So perhaps keeping the original strdup(realpath()) would make more sense.
> Also, checking specifically for error of realpath() and returning on error
> might shrink the diff.  Style change only.

Ahh yes, I saw POSIX and assumed it was portable, but:

"POSIX.1-2001 says that the behavior if resolved_path is NULL is
implementation-defined.  POSIX.1-2008 specifies the behavior described
in this page."

Really however the code needs to be re-worked so directory creation
works again. Is there a portable way of checking if a path is relative
and needs a realpath step?

--
Alex, homepage: http://www.bennee.com/~alex/
http://www.half-llama.co.uk



-- 
Alex, homepage: http://www.bennee.com/~alex/
http://www.half-llama.co.uk



More information about the rrd-developers mailing list