- PKASSERT(ret > 0, "PKCGET READ", "", ret);
- b += ret;
+ if (ret <= 0) {
+ alarm(0);
+ logent("PKCGET read failed", sys_errlist[errno]);
+ longjmp(Sjbuf, 6);
+ }
+ b += ret;
+ nchars += ret;
+ if (nchars < n)
+#ifndef BSD4_2
+ if (linebaudrate > 0 && linebaudrate < 4800)
+ sleep(1);
+#else BSD4_2
+ if (linebaudrate > 0) {
+ r = (n - nchars) * 100000;
+ r = r / linebaudrate;
+ r = (r * 100) - itime;
+ itime = 0;
+ /* we predict that more than 1/50th of a
+ second will go by before the read will
+ give back all that we want. */
+ if (r > 20000) {
+ tv.tv_sec = r / 1000000L;
+ tv.tv_usec = r % 1000000L;
+ DEBUG(11, "PKCGET stall for %d", tv.tv_sec);
+ DEBUG(11, ".%06d sec\n", tv.tv_usec);
+ (void) select (fn, (int *)0, (int *)0, (int *)0, &tv);
+ }
+ }
+#endif BSD4_2