]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1570] serial line drivers get outdated data from kernel tty line buffer after...
authorJuergen Perlinger <perlinger@ntp.org>
Fri, 4 Jun 2010 17:21:26 +0000 (19:21 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Fri, 4 Jun 2010 17:21:26 +0000 (19:21 +0200)
bk: 4c093616Fn73LOrQDeD-BBJto8MfXA

ChangeLog
ntpd/ntp_refclock.c

index cdd054e933f0adda9a437380fa6a3aa56597a0eb..b8947a0da71e2a2486d60320ac22bb1d4c5adff2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,5 @@
-* [Bug 1580] serial clock drivers get outdated input from kernel
-  tty line buffer after startup
+* [Bug 1570] serial clock drivers get outdated input from kernel tty
+  line buffer after startup
 (4.2.7p33) 2010/06/04 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1561] from 4.2.6p2-RC5: ntpq, ntpdc "passwd" prompts for MD5
   password w/SHA1.
index 249c998c460be2ef9d5aace86a2683dfb8d5074f..3fb18e07a163a9c5b7d0d9fad846cd9d7a854690 100644 (file)
@@ -746,11 +746,11 @@ refclock_open(
 #ifdef O_NONBLOCK
        /*
         * We want to make sure there is no pending trash in the input
-        * buffer. Since we have none-blocking IO available, this is a good
-        * moment to read and dump all available outdated stuff that might have
-        * become toxic for the driver.
+        * buffer. Since we have none-blocking IO available, this is a
+        * good moment to read and dump all available outdated stuff
+        * that might have become toxic for the driver.
         */
-       while (read(fd, trash, sizeof(trash)) > 0)
+       while (read(fd, trash, sizeof(trash)) > 0 || errno == EINTR)
                /*NOP*/;
 #endif
        return (fd);
@@ -850,13 +850,12 @@ refclock_setup(
        }
 
        /*
-        * flush input and output buffers to discard any outdated stuff that
-        * might have become toxic for the driver. Failing to do so is logged,
-        * but we keep our fingers crossed otherwise.
+        * flush input and output buffers to discard any outdated stuff
+        * that might have become toxic for the driver. Failing to do so
+        * is logged, but we keep our fingers crossed otherwise.
         */
-       if (tcflush(fd, TCIOFLUSH) < 0) {
+       if (tcflush(fd, TCIOFLUSH) < 0)
                msyslog(LOG_ERR, "refclock_setup fd %d tcflush(): %m", fd);
-       }
 #endif /* HAVE_TERMIOS */
 
 #ifdef HAVE_SYSV_TTYS