Commit | Line | Data |
---|---|---|
61ae2fbf JH |
1 | /* Wrapper around broken system errno.h. */ |
2 | ||
3 | #ifndef _PERL_WRAPPER_AROUND_ERRNO_H | |
4 | # define _PERL_WRAPPER_AROUND_ERRNO_H 1 | |
5 | ||
6 | /* First include the system file. */ | |
7 | #include_next <errno.h> | |
8 | ||
9 | /* Now add the missing stuff. | |
10 | #ifndef EAGAIN | |
11 | # define EAGAIN EWOULDBLOCK | |
12 | #endif | |
13 | ||
14 | /* This one is problematic. If you open() a directory with the | |
15 | MiNTLib you can't detect from errno if it is really a directory | |
16 | or if the file simply doesn't exist. You'll get ENOENT | |
17 | ("file not found") in either case. | |
18 | ||
19 | Defining EISDIR as ENOENT is actually a bad idea but works fine | |
20 | in general. In praxi, if code checks for errno == EISDIR it | |
21 | will attempt an opendir() call on the file in question and this | |
22 | call will also file if the file really can't be found. But | |
23 | you may get compile-time errors if the errno checking is embedded | |
24 | in a switch statement ("duplicate case value in switch"). | |
25 | ||
26 | Anyway, here the define works alright. */ | |
27 | #ifndef EISDIR | |
28 | # define EISDIR ENOENT | |
29 | #endif | |
30 | ||
31 | #endif | |
32 |