[Please CC me, as I'm not subscribed to this list]

Hallo,

while dealing with PR ports/157274 [1], I found that the following
program cause a segmentation fault on 7.3-RELEASE amd64, even though 
my understanding of the man page of fdopendir(3) says it should not.

#include <fcntl.h>
#include <sys/types.h>
#include <dirent.h>

int main(int argc, char **argv) {
  DIR *dirp;
  int fd;

  fd = open(".", O_RDONLY);
  dirp = fdopendir(fd);
  (void) readdir(dirp);

}

Compiling gives the warning "assignment makes pointer from integer without a 
cast"
refering to the line with the fdopendir call. Indeed, adding the prototype

extern DIR *fdopendir(int);

right after the #include lines solves this problem. Is my understanding of the 
man page that the above #include lines should suffice incorrect? Is this
problem known---or even fixed already?

I have reports that indicate that this problem also seems to exist on 
7.3-RELEASE-p4 amd64
and 8.1-RELEASE i386. The above program does not segfault on my 8.2-STABLE 
amd64.

Any hints on the status of this observation are very welcome.

Best regards,
Klaus


[1] http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/157274

_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to