| 2028 | #ifdef SYSCF |
| 2029 | #ifdef SYSCF_FILE |
| 2030 | void |
| 2031 | assure_syscf_file(void) |
| 2032 | { |
| 2033 | int fd; |
| 2034 | |
| 2035 | #ifdef WIN32 |
| 2036 | /* We are checking that the sysconf exists ... lock the path */ |
| 2037 | fqn_prefix_locked[SYSCONFPREFIX] = TRUE; |
| 2038 | #endif |
| 2039 | /* |
| 2040 | * All we really care about is the end result - can we read the file? |
| 2041 | * So just check that directly. |
| 2042 | * |
| 2043 | * Not tested on most of the old platforms (which don't attempt |
| 2044 | * to implement SYSCF). |
| 2045 | * Some ports don't like open()'s optional third argument; |
| 2046 | * VMS overrides open() usage with a macro which requires it. |
| 2047 | */ |
| 2048 | #ifndef VMS |
| 2049 | #if defined(NOCWD_ASSUMPTIONS) && defined(WIN32) |
| 2050 | fd = open(fqname(SYSCF_FILE, SYSCONFPREFIX, 0), O_RDONLY); |
| 2051 | #else |
| 2052 | fd = open(SYSCF_FILE, O_RDONLY); |
| 2053 | #endif |
| 2054 | #else /* VMS */ |
| 2055 | fd = open(SYSCF_FILE, O_RDONLY, 0); |
| 2056 | #endif /* VMS */ |
| 2057 | if (fd >= 0) { |
| 2058 | /* readable */ |
| 2059 | close(fd); |
| 2060 | return; |
| 2061 | } |
| 2062 | #ifndef SFCTOOL |
| 2063 | if (gd.deferred_showpaths) |
| 2064 | do_deferred_showpaths(1); /* does not return */ |
| 2065 | #endif |
| 2066 | raw_printf("Unable to open SYSCF_FILE.\n"); |
| 2067 | exit(EXIT_FAILURE); |
| 2068 | } |
| 2069 | |
| 2070 | #endif /* SYSCF_FILE */ |
| 2071 | #endif /* SYSCF */ |
no test coverage detected