PATCH: linux-generic dup2 behaviour
Chris Metcalf
cmetcalf@tilera.com
Wed Sep 14 16:13:00 GMT 2011
On 9/14/2011 12:06 PM, Linas Vepstas wrote:
> The m4 test cases aren't all that stunning; for me, 3 of 108 failed,
> and this patch should fix 2 of these. The third was test-readlink which
> is expecting
> readlink("", buf, sizeof buf);
> to set ENOENT, and instead it sets EINVAL
>
> I was willing to ascribe this to poor test case design, but now that
> we're on topic... any suggestions?
That's puzzling. The in-kernel version just does readlinkat(AT_FDCWD,
path, buf, bufsiz), which is all the "generic" glibc code does, in
userspace. I would expect them to return the same errnos, and in fact a
quick test on Tile does get ENOENT:
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
int main(void)
{
char buf[1000];
errno = 0;
int rc = readlink("", buf, sizeof buf);
printf("%d/%d\n", rc, errno);
return 0;
}
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
More information about the Libc-ports
mailing list