Some more code simplifications.
This commit is contained in:
parent
1b44b886c0
commit
25d8fc0969
@ -540,14 +540,11 @@ serial_drain (serial *device)
|
|||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
return -1; // EINVAL (Invalid argument)
|
return -1; // EINVAL (Invalid argument)
|
||||||
|
|
||||||
int rc = 0;
|
while (tcdrain (device->fd) != 0) {
|
||||||
do {
|
if (errno != EINTR ) {
|
||||||
rc = tcdrain (device->fd);
|
TRACE ("tcdrain");
|
||||||
} while (rc == -1 && errno == EINTR);
|
return -1;
|
||||||
|
}
|
||||||
if (rc != 0) {
|
|
||||||
TRACE ("tcdrain");
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -642,14 +639,11 @@ serial_sleep (unsigned long timeout)
|
|||||||
ts.tv_sec = (timeout / 1000);
|
ts.tv_sec = (timeout / 1000);
|
||||||
ts.tv_nsec = (timeout % 1000) * 1000000;
|
ts.tv_nsec = (timeout % 1000) * 1000000;
|
||||||
|
|
||||||
int rc = 0;
|
while (nanosleep (&ts, &ts) != 0) {
|
||||||
do {
|
if (errno != EINTR ) {
|
||||||
rc = nanosleep (&ts, &ts);
|
TRACE ("nanosleep");
|
||||||
} while (rc == -1 && errno == EINTR);
|
return -1;
|
||||||
|
}
|
||||||
if (rc != 0) {
|
|
||||||
TRACE ("nanosleep");
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user