updated for version 7.0-130
diff --git a/src/fileio.c b/src/fileio.c
index 42181e1..7bab84e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -419,6 +419,20 @@
}
#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 @@
}
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;