Terminate serialdump when serial device disconnects
The running serialdump does not recover from a disconnected device but runs indefinitely with outputting anything. This makes it quit with a proper error message.
This commit is contained in:
parent
2974b796d1
commit
9e080e8aa5
@ -281,6 +281,11 @@ main(int argc, char **argv)
|
|||||||
perror("could not read");
|
perror("could not read");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
if(n == 0) {
|
||||||
|
errno = EBADF;
|
||||||
|
perror("serial device disconnected");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
for(i = 0; i < n; i++) {
|
for(i = 0; i < n; i++) {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
|
Loading…
Reference in New Issue
Block a user