If no serial console is configured, don't bother calling into it
authorH. Peter Anvin <hpa@zytor.com>
Thu, 31 May 2007 22:53:37 +0000 (15:53 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 31 May 2007 22:53:37 +0000 (15:53 -0700)
If there is no serial console configured, we can simply drop writes
from com32 rather than letting syslinux do that.

com32/lib/sys/serial_write.c
com32/lib/sys/xserial_write.c

index 0235620..b593083 100644 (file)
@@ -35,6 +35,7 @@
 #include <string.h>
 #include <com32.h>
 #include <minmax.h>
+#include <syslinux/config.h>
 #include "file.h"
 
 ssize_t __serial_write(struct file_info *fp, const void *buf, size_t count)
@@ -45,6 +46,9 @@ ssize_t __serial_write(struct file_info *fp, const void *buf, size_t count)
 
   (void)fp;
 
+  if (!syslinux_serial_console_info()->iobase)
+    return count;              /* Nothing to do */
+
   memset(&ireg, 0, sizeof ireg);
   ireg.eax.b[1] = 0x04;
 
index ebdf296..7964042 100644 (file)
@@ -37,6 +37,7 @@
 #include <com32.h>
 #include <minmax.h>
 #include <colortbl.h>
+#include <syslinux/config.h>
 #include "file.h"
 
 static void emit(char ch)
@@ -61,6 +62,9 @@ ssize_t __xserial_write(struct file_info *fp, const void *buf, size_t count)
 
   (void)fp;
 
+  if (!syslinux_serial_console_info()->iobase)
+    return count;              /* Nothing to do */
+
   while ( count-- ) {
     unsigned char ch = *bufp++;