Changeset 3473 for trunk/src/kash/shfile.c
- Timestamp:
- Sep 16, 2020, 11:12:58 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/shfile.c
r3471 r3473 36 36 37 37 #if K_OS == K_OS_WINDOWS 38 # include <limits.h>39 # ifndef PIPE_BUF40 # define PIPE_BUF 51241 # endif42 38 # include <ntstatus.h> 43 39 # define WIN32_NO_STATUS … … 1711 1707 1712 1708 fds[1] = fds[0] = -1; 1713 if (CreatePipe(&hRead, &hWrite, &SecurityAttributes, 4096))1709 if (CreatePipe(&hRead, &hWrite, &SecurityAttributes, SHFILE_PIPE_SIZE)) 1714 1710 { 1715 1711 fds[0] = shfile_insert(pfdtab, (intptr_t)hRead, O_RDONLY, SHFILE_FLAGS_PIPE, -1, "shfile_pipe", "pipe-rd"); … … 2193 2189 #else 2194 2190 return stat(path, pst); 2191 #endif 2192 } 2193 2194 /** 2195 * @retval 1 if regular file. 2196 * @retval 0 if found but not a regular file. 2197 * @retval -1 and errno on failure 2198 */ 2199 int shfile_stat_isreg(shfdtab *pfdtab, const char *path) 2200 { 2201 #if defined(SHFILE_IN_USE) && K_OS == K_OS_WINDOWS 2202 char abspath[SHFILE_MAX_PATH]; 2203 KU16 mode = 0; 2204 int rc = shfile_make_path(pfdtab, path, &abspath[0]); 2205 if (!rc) 2206 { 2207 rc = birdStatModeOnly(abspath, &mode, 0 /*fFollowLink*/); 2208 if (rc >= 0) 2209 rc = S_ISREG(mode) ? 1 : 0; 2210 } 2211 TRACE2((NULL, "shfile_stat_isreg(,%s,) -> %d [%d] st_mode=%o\n", path, rc, errno, mode)); 2212 return rc; 2213 #else 2214 struct stat st; 2215 int rc = shfile_stat(pfdtab, path, &st); 2216 if (rc >= 0) 2217 rc = S_ISREG(st.st_mode) ? 1 : 0; 2218 return rc; 2219 #endif 2220 } 2221 2222 /** 2223 * Same as shfile_stat, but without the data structure. 2224 */ 2225 int shfile_stat_exists(shfdtab *pfdtab, const char *path) 2226 { 2227 #if defined(SHFILE_IN_USE) && K_OS == K_OS_WINDOWS 2228 char abspath[SHFILE_MAX_PATH]; 2229 KU16 mode = 0; 2230 int rc = shfile_make_path(pfdtab, path, &abspath[0]); 2231 if (!rc) 2232 rc = birdStatModeOnly(abspath, &mode, 0 /*fFollowLink*/); 2233 TRACE2((NULL, "shfile_stat_exists(,%s,) -> %d [%d] st_mode=%o\n", path, rc, errno, mode)); 2234 return rc; 2235 #else 2236 struct stat ignored; 2237 return shfile_stat(pfdtab, path, &ignored); 2195 2238 #endif 2196 2239 }
Note:
See TracChangeset
for help on using the changeset viewer.