summaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-10-10 16:44:07 +0000
committerBram Moolenaar <Bram@vim.org>2006-10-10 16:44:07 +0000
commit043545e0f63b74585a6257b23a1e8b59b6a08c29 (patch)
treec86b2ef48078e41f6254387d4e3be2a8f067c7a7 /src/fileio.c
parent57ac3a21635afec3066fdbc282ca7d8eb80976cf (diff)
updated for version 7.0-130v7.0.130
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 42181e17b2..7bab84e55f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -419,6 +419,20 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
}
#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, eap, append, forceit,
}
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;