Am I the only one who's seeing this weirdness with procfs on 9.0-RELEASE-p3. Unless I'm overlooking something stupid, a process that rmdir(2)s a subdirectory of its current directory ends up with a broken /proc/curproc/file symlink:

[mrsam@freebsd ~/stasher/stasher]$ cat t.c
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>

void dump(int n)
{
        char buf[2048];

        printf("Line %d, rc=%s\n", n,
               (readlink("/proc/curproc/file", buf, 2048) < 0 ? "err":"ok"));
}

int main(int argc, char **argv)
{
        dump(__LINE__);
        mkdir("conftestdir.tst", 0777);
        rmdir("conftestdir.tst");
        dump(__LINE__);
}
[mrsam@freebsd ~/stasher/stasher]$ cc -o t t.c
[mrsam@freebsd ~/stasher/stasher]$ ./t
Line 15, rc=ok
Line 18, rc=err

???????

Attachment: pgp8on2RgFH47.pgp
Description: PGP signature

Reply via email to