comparison src/fileio.c @ 5322:9801d06e7b4c v7.4.014

updated for version 7.4.014 Problem: MS-Windows: check for writing to device does not work. Solution: Fix #ifdefs. (Ken Takata)
author Bram Moolenaar <bram@vim.org>
date Fri, 30 Aug 2013 17:07:01 +0200
parents 8b5d80861c5e
children 6707c44cec61
comparison
equal deleted inserted replaced
5321:4bc1b41f558c 5322:9801d06e7b4c
426 msg_scroll = msg_save; 426 msg_scroll = msg_save;
427 return FAIL; 427 return FAIL;
428 } 428 }
429 } 429 }
430 430
431 if (!read_stdin && !read_buffer)
432 {
431 #ifdef UNIX 433 #ifdef UNIX
432 /* 434 /*
433 * On Unix it is possible to read a directory, so we have to 435 * On Unix it is possible to read a directory, so we have to
434 * check for it before the mch_open(). 436 * check for it before the mch_open().
435 */ 437 */
436 if (!read_stdin && !read_buffer)
437 {
438 perm = mch_getperm(fname); 438 perm = mch_getperm(fname);
439 if (perm >= 0 && !S_ISREG(perm) /* not a regular file ... */ 439 if (perm >= 0 && !S_ISREG(perm) /* not a regular file ... */
440 # ifdef S_ISFIFO 440 # ifdef S_ISFIFO
441 && !S_ISFIFO(perm) /* ... or fifo */ 441 && !S_ISFIFO(perm) /* ... or fifo */
442 # endif 442 # endif
455 filemess(curbuf, fname, (char_u *)_("is not a file"), 0); 455 filemess(curbuf, fname, (char_u *)_("is not a file"), 0);
456 msg_end(); 456 msg_end();
457 msg_scroll = msg_save; 457 msg_scroll = msg_save;
458 return FAIL; 458 return FAIL;
459 } 459 }
460 460 #endif
461 # if defined(MSDOS) || defined(MSWIN) || defined(OS2) 461 #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
462 /* 462 /*
463 * MS-Windows allows opening a device, but we will probably get stuck 463 * MS-Windows allows opening a device, but we will probably get stuck
464 * trying to read it. 464 * trying to read it.
465 */ 465 */
466 if (!p_odev && mch_nodetype(fname) == NODE_WRITABLE) 466 if (!p_odev && mch_nodetype(fname) == NODE_WRITABLE)
468 filemess(curbuf, fname, (char_u *)_("is a device (disabled with 'opendevice' option)"), 0); 468 filemess(curbuf, fname, (char_u *)_("is a device (disabled with 'opendevice' option)"), 0);
469 msg_end(); 469 msg_end();
470 msg_scroll = msg_save; 470 msg_scroll = msg_save;
471 return FAIL; 471 return FAIL;
472 } 472 }
473 # endif 473 #endif
474 } 474 }
475 #endif
476 475
477 /* Set default or forced 'fileformat' and 'binary'. */ 476 /* Set default or forced 'fileformat' and 'binary'. */
478 set_file_options(set_options, eap); 477 set_file_options(set_options, eap);
479 478
480 /* 479 /*