I have a program which opens a file and checks its length.
FILE* fd = fopen(argv[1], \"rb\");
fseek(fd, 0, SEEK_END);
size_t flen = ftell(fd);
if (flen == ((
From http://pubs.opengroup.org/onlinepubs/7908799/xsh/fopen.html:
The fopen() function will fail if:
[EISDIR] The named file is a directory and mode requires write access.
At least on Linux, if you try to fopen("dirname", "wb") you get an EISDIR error. I also tried with a directory with d-------- access rights, and I still get EISDIR (and not EACCES.)