On Sat, Nov 15, 2008 at 6:52 AM, Bram Moolenaar <[EMAIL PROTECTED]> wrote: > > James - > >> Then this appears to be a difference (bug?) in your libc. This is not >> the case with glibc 2.7 or 2.8 (the two systems I can currently test >> on). Those error with ENOENT (as specified by SUS[0]). > > I'm on FreeBSD. I used this test program: > > #include <stdio.h> > #include <sys/param.h> > #include <stdlib.h> > #include <errno.h> > > main() > { > char buf[PATH_MAX]; > char *s; > errno = 0; > buf[0] = 0; > s = realpath("", buf); > printf("errno = %d; s = %s; buf = %s\n", errno, s, buf); > } > > Result (when pwd is /tmp): > > errno = 0; s = /tmp; buf = /tmp
errno = 2; s = (null); buf = > The definition of realpath() doesn't say what happens for an empty > string. It might handle it as "." or give an error. SUS does specify what should happen. It's an error. FWIW, I've filed a bug[0] against FreeBSD's behavior so we'll see what they think about it. > Did you test my proposed solution on Linux? I think it should work > everywhere. Yes, I did. It works fine. [0] - http://www.freebsd.org/cgi/query-pr.cgi?pr=128933 -- James GPG Key: 1024D/61326D40 2003-09-02 James Vega <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]