On Wed, 27 Jun 2018 at 21:35:31 -0500, joshua stein wrote:
>       symlink("/tmp/link", "/tmp/nonexistent");

Oops, I changed this test code at the last second.  The proper test 
code which incorrectly prints on OpenBSD:

resolved realpath of /tmp/nonexistent (returned /tmp/nonexistent), errno is 2


#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main()
{
        char resolved[1024];
        char *ret;

        unlink("/tmp/link");
        unlink("/tmp/nonexistent");
        symlink("/tmp/nonexistent", "/tmp/link");

        ret = realpath("/tmp/link", resolved);
        if (ret == NULL)
                printf("realpath failed: %s\n", strerror(errno));
        else
                printf("resolved realpath of %s (returned %s), errno is %d\n",
                    resolved, ret, errno);

        return (0);
}

Reply via email to