Mercurial > vim
diff src/fileio.c @ 1004:09d0e83c29b8 v7.0.130
updated for version 7.0-130
author | vimboss |
---|---|
date | Tue, 10 Oct 2006 16:44:07 +0000 |
parents | 0e3e208b4b90 |
children | 992d5c69d5e9 |
line wrap: on
line diff
--- a/src/fileio.c +++ b/src/fileio.c @@ -419,6 +419,20 @@ readfile(fname, sfname, from, lines_to_s } #endif +#if defined(MSDOS) || defined(MSWIN) || defined(OS2) + /* + * MS-Windows allows opening a device, but we will probably get stuck + * trying to read it. + */ + if (!p_odev && mch_nodetype(fname) == NODE_WRITABLE) + { + filemess(curbuf, fname, (char_u *)_("is a device (disabled with 'opendevice' option"), 0); + msg_end(); + msg_scroll = msg_save; + return FAIL; + } +#endif + /* set default 'fileformat' */ if (set_options) { @@ -3163,6 +3177,16 @@ buf_write(buf, fname, sfname, start, end } if (c == NODE_WRITABLE) { +# if defined(MSDOS) || defined(MSWIN) || defined(OS2) + /* MS-Windows allows opening a device, but we will probably get stuck + * trying to write to it. */ + if (!p_odev) + { + errnum = (char_u *)"E796: "; + errmsg = (char_u *)_("writing to device disabled with 'opendevice' option"); + goto fail; + } +# endif device = TRUE; newfile = TRUE; perm = -1;