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
1 changed files with 5 additions and 0 deletions
|
@ -281,6 +281,11 @@ main(int argc, char **argv)
|
|||
perror("could not read");
|
||||
exit(-1);
|
||||
}
|
||||
if(n == 0) {
|
||||
errno = EBADF;
|
||||
perror("serial device disconnected");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
for(i = 0; i < n; i++) {
|
||||
switch(mode) {
|
||||
|
|
Loading…
Reference in a new issue