Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Sep 2012 21:46:17 -0400
From:      Sam Varshavchik <mrsam@courier-mta.com>
To:        freebsd-hackers@freebsd.org
Subject:   What happened to my /proc/curproc/file?
Message-ID:  <cone.1346723177.448775.23058.1000@monster.email-scan.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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 #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEABECAAYFAlBFXWkACgkQx9p3GYHlUOIdiwCfTA/gJcjma05KVAyGYIyRNT9R
UI8AniF646pssQnIJW6qyIm6G4JcQWhg
=bY6o
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cone.1346723177.448775.23058.1000>