Index: src/interface.c
--- src/interface.c.orig
+++ src/interface.c
@@ -80,6 +80,15 @@
 
 #include <Xm/XmAll.h>
 
+#ifdef __OpenBSD__
+#include <paths.h>
+#endif
+#ifdef _PATH_UUCPLOCK
+#define	LOCK_DIR	_PATH_UUCPLOCK
+#else
+#define	LOCK_DIR	"/var/lock"
+#endif
+
 #include "xastir.h"
 #include "symbols.h"
 #include "main.h"
@@ -2717,7 +2726,7 @@ int serial_detach(int port)
     }
 
     // Delete lockfile
-    xastir_snprintf(fn, sizeof(fn), "/var/lock/LCK..%s", get_device_name_only(port_data[port].device_name));
+    xastir_snprintf(fn, sizeof(fn), "%s/LCK..%s", LOCK_DIR, get_device_name_only(port_data[port].device_name));
     if (debug_level & 2)
     {
       fprintf(stderr,"Delete lock file %s\n",fn);
@@ -2829,7 +2838,7 @@ int serial_init (int port)
 
 
   // check for lockfile
-  xastir_snprintf(fn, sizeof(fn), "/var/lock/LCK..%s",
+  xastir_snprintf(fn, sizeof(fn), "%s/LCK..%s", LOCK_DIR,
                   get_device_name_only(port_data[port].device_name));
 
   if (filethere(fn) == 1)
@@ -3022,8 +3031,19 @@ int serial_init (int port)
     return (-1);
   }
 
+  #ifdef NMEADISC
+  if (port_data[port].device_type == DEVICE_SERIAL_GPS) {
+        int ldisc = NMEADISC, ret;
+        ENABLE_SETUID_PRIVILEGE;
+        ret = ioctl(port_data[port].channel, TIOCSETD, &ldisc);
+        DISABLE_SETUID_PRIVILEGE;
+        if (ret == -1)
+          fprintf(stderr, "couldn't set nmea discipline on port %d", port);
+  }
+  #endif
+
   // Attempt to create the lockfile
-  xastir_snprintf(fn, sizeof(fn), "/var/lock/LCK..%s", get_device_name_only(port_data[port].device_name));
+  xastir_snprintf(fn, sizeof(fn), "%s/LCK..%s", LOCK_DIR, get_device_name_only(port_data[port].device_name));
   if (debug_level & 2)
   {
     fprintf(stderr,"Create lock file %s\n",fn);
@@ -3454,11 +3474,12 @@ int net_init(int port)
 
   ok = -1;
 
-
+  memset(&hints, 0, sizeof(hints));
   hints.ai_family = AF_UNSPEC;
   hints.ai_socktype = SOCK_STREAM;
   hints.ai_protocol = 0;
   hints.ai_flags = AI_NUMERICSERV|AI_ADDRCONFIG;
+
   xastir_snprintf(port_num, sizeof(port_num), "%d", port_data[port].socket_port);
 
   xastir_snprintf(st, sizeof(st), langcode("BBARSTA019"), port_data[port].device_host_name);
