Bug#785404: hurd: opendir("/dev/null") succeeds
Package: libc0.3
Version: 2.19-18+b1
richard@heceptor:~/junk$ cat t.c
#include <dirent.h>
#include <assert.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main() {
DIR *dp = opendir("/dev/null");
printf("%p\n", dp);
struct dirent *de = readdir(dp);
printf("%p %d %s\n", de, errno, strerror(errno));
return 0;
}
richard@heceptor:~/junk$ gcc -o t t.c && ./t
0x804a0e0
(nil) 1073741844 Not a directory
ii hurd 1:0.6-4 hurd-i386 GNU Hurd
ii libc0.3:hurd-i 2.19-18+b1 hurd-i386 GNU C Library: Shared libraries
Based on Glibc history there used to be some defence against this, but
it was removed in 2006.
ttfn/rjk
Reply to: