openbsd-ports/comms/seyon/patches/patch-SePort_c
naddy 1808021952 * return -1 by int rather than char
* md5 -> distinfo
* sensible patch names
2002-02-20 21:46:48 +00:00

94 lines
2.0 KiB
Plaintext

$OpenBSD: patch-SePort_c,v 1.1 2002/02/20 21:46:49 naddy Exp $
--- SePort.c.orig Wed Apr 21 15:38:31 1993
+++ SePort.c Wed Feb 20 22:31:21 2002
@@ -56,8 +56,8 @@
#define MAX_INPUT _POSIX_MAX_INPUT
#endif
-extern char TtyReadChar();
-extern int TtyReadStr(),
+extern int TtyReadChar(),
+ TtyReadStr(),
TtyTimedReadChar(),
TtyReadLine(),
TtyTimedWaitFor(),
@@ -627,19 +627,25 @@ mbaud(s)
#endif
break;
#if USE_NONSTD_BAUD
-#ifdef linux
case 57600:
+#ifdef linux
baudrate = B38400;
ser_io.flags &= ~ASYNC_SPD_MASK;
ser_io.flags |= ASYNC_SPD_HI;
+#else
+ baudrate = B57600;
+#endif
break;
case 115200:
+#ifdef linux
baudrate = B38400;
ser_io.flags &= ~ASYNC_SPD_MASK;
ser_io.flags |= ASYNC_SPD_VHI;
+#else
+ baudrate = B115200;
+#endif
break;
#endif
-#endif
default:
return (-1);
}
@@ -691,6 +697,14 @@ mbaud(s)
#endif
#endif
return 38400;
+#if USE_NONSTD_BAUD
+#ifndef linux
+ case B57600:
+ return(57600);
+ case B115200:
+ return(115200);
+#endif
+#endif
}
SeError("Consistency error in baud rate");
@@ -865,7 +879,7 @@ MdmReadStr(buf)
* MdmReadChar: reads one character from the modem.
*/
-char
+int
MdmReadChar(readChar)
char *readChar;
{
@@ -997,6 +1011,7 @@ lock_tty()
pid_t pid,
lckpid;
char *modemname;
+ int killret;
#if LF_USE_ASCII_PID
char pidstr[20],
lckpidstr[20];
@@ -1063,11 +1078,13 @@ relink:
#endif
lockPid = (pid_t) lckpid;
- if (kill(lckpid, 0) == 0) {
- SeErrorF("Device %s is locked by process %d", modem_port, lckpid, "");
- unlink(ltmp);
- return -1;
- }
+ killret = kill(lockPid, 0);
+ if(killret == 0 || (killret == -1 && errno != ESRCH)) {
+ SeErrorF("Device %s is locked by process %d.",
+ modem_port, lckpid, "");
+ unlink(ltmp);
+ return -1;
+ }
}
}