[bug?][6.2][6.2.1?] realpath() returns leaky string

realpath() does properly return NULL for errornous path,
but doesn’t fill the result buffer contrary to
the doc’s “contains the pathname that caused the problem”.

And why does it return error for “/net” ?

(And this seems to be procnto problem, not libc…)

kabe

------------------- realpath.c -------------------
#if shell
${CC=qcc} $0
…/a.out /nosuchdir /net / /net
exit
#endif

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int
main(int argc, char *argv[])
{
char buf[PATH_MAX];
int i;

for (i=1; i<argc; i++) {
if (realpath(argv_, buf)) {
puts(buf);
} else {
fprintf(stderr, “err: <%s>\n”, buf);
}
}
}_