9dc7238ff0
From new maintainer Antoine Jacoutot <ajacoutot@lphp.org>
29 lines
751 B
Plaintext
29 lines
751 B
Plaintext
$OpenBSD: patch-libpisock_unixserial_c,v 1.1 2004/12/11 04:59:46 pvalchev Exp $
|
|
--- libpisock/unixserial.c.orig Tue Jul 30 09:52:24 2002
|
|
+++ libpisock/unixserial.c Fri Dec 10 21:51:33 2004
|
|
@@ -178,13 +178,23 @@ s_open(struct pi_socket *ps, struct pi_s
|
|
i;
|
|
char *tty = addr->pi_device;
|
|
struct pi_serial_data *data = (struct pi_serial_data *)ps->device->data;
|
|
+#define maxretries 100
|
|
+ int retries;
|
|
|
|
#ifndef SGTTY
|
|
struct termios tcn;
|
|
#else
|
|
struct sgttyb tcn;
|
|
#endif
|
|
- if ((fd = open(tty, O_RDWR | O_NONBLOCK)) == -1) {
|
|
+
|
|
+ for (retries = 0 ; retries <= maxretries ; retries++ ) {
|
|
+ if ((fd = open(tty, O_RDWR | O_NONBLOCK)) != -1) {
|
|
+ break;
|
|
+ }
|
|
+ usleep(50000);
|
|
+ }
|
|
+
|
|
+ if (fd == -1) {
|
|
return -1; /* errno already set */
|
|
}
|
|
|