comparison src/fileio.c @ 14509:80f715651c4c v8.1.0268

patch 8.1.0268: file type checking has too many #ifdef commit https://github.com/vim/vim/commit/d569bb029983cff947dce704e6f830276204c13f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 11 13:57:20 2018 +0200 patch 8.1.0268: file type checking has too many #ifdef Problem: File type checking has too many #ifdef. Solution: Always define the S_IF macros. (Ken Takata, closes https://github.com/vim/vim/issues/3306)
author Christian Brabandt <cb@256bit.org>
date Sat, 11 Aug 2018 14:00:05 +0200
parents dddba3937532
children c8f07e8b273e
comparison
equal deleted inserted replaced
14508:7336a81d18c4 14509:80f715651c4c
422 * On Unix it is possible to read a directory, so we have to 422 * On Unix it is possible to read a directory, so we have to
423 * check for it before the mch_open(). 423 * check for it before the mch_open().
424 */ 424 */
425 perm = mch_getperm(fname); 425 perm = mch_getperm(fname);
426 if (perm >= 0 && !S_ISREG(perm) /* not a regular file ... */ 426 if (perm >= 0 && !S_ISREG(perm) /* not a regular file ... */
427 # ifdef S_ISFIFO
428 && !S_ISFIFO(perm) /* ... or fifo */ 427 && !S_ISFIFO(perm) /* ... or fifo */
429 # endif
430 # ifdef S_ISSOCK
431 && !S_ISSOCK(perm) /* ... or socket */ 428 && !S_ISSOCK(perm) /* ... or socket */
432 # endif
433 # ifdef OPEN_CHR_FILES 429 # ifdef OPEN_CHR_FILES
434 && !(S_ISCHR(perm) && is_dev_fd_file(fname)) 430 && !(S_ISCHR(perm) && is_dev_fd_file(fname))
435 /* ... or a character special file named /dev/fd/<n> */ 431 /* ... or a character special file named /dev/fd/<n> */
436 # endif 432 # endif
437 ) 433 )
2495 { 2491 {
2496 msg_add_fname(curbuf, sfname); /* fname in IObuff with quotes */ 2492 msg_add_fname(curbuf, sfname); /* fname in IObuff with quotes */
2497 c = FALSE; 2493 c = FALSE;
2498 2494
2499 #ifdef UNIX 2495 #ifdef UNIX
2500 # ifdef S_ISFIFO 2496 if (S_ISFIFO(perm)) /* fifo */
2501 if (S_ISFIFO(perm)) /* fifo or socket */
2502 {
2503 STRCAT(IObuff, _("[fifo/socket]"));
2504 c = TRUE;
2505 }
2506 # else
2507 # ifdef S_IFIFO
2508 if ((perm & S_IFMT) == S_IFIFO) /* fifo */
2509 { 2497 {
2510 STRCAT(IObuff, _("[fifo]")); 2498 STRCAT(IObuff, _("[fifo]"));
2511 c = TRUE; 2499 c = TRUE;
2512 } 2500 }
2513 # endif 2501 if (S_ISSOCK(perm)) /* or socket */
2514 # ifdef S_IFSOCK
2515 if ((perm & S_IFMT) == S_IFSOCK) /* or socket */
2516 { 2502 {
2517 STRCAT(IObuff, _("[socket]")); 2503 STRCAT(IObuff, _("[socket]"));
2518 c = TRUE; 2504 c = TRUE;
2519 } 2505 }
2520 # endif
2521 # endif
2522 # ifdef OPEN_CHR_FILES 2506 # ifdef OPEN_CHR_FILES
2523 if (S_ISCHR(perm)) /* or character special */ 2507 if (S_ISCHR(perm)) /* or character special */
2524 { 2508 {
2525 STRCAT(IObuff, _("[character special]")); 2509 STRCAT(IObuff, _("[character special]"));
2526 c = TRUE; 2510 c = TRUE;