diff options
author | rvalovyi <49940758+rvalovyi@users.noreply.github.com> | 2021-11-03 01:22:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-03 08:22:21 +0900 |
commit | 9fba07b326eb90e1864848b2c8244f6203f4209a (patch) | |
tree | 3c416bcc65d3b9c93592f1f2e9893be58f535f6d | |
parent | 1f51eab36c363041bc18ed194500e8dae9a8aeed (diff) | |
download | DLT-daemon-9fba07b326eb90e1864848b2c8244f6203f4209a.tar.gz |
daemon: Do not exit when accept returns ECONNABORTED (#347)
Scan of port 3490 from a Linux machine by
'nmap -v -p 3490 -Pn IP_address_of_QNX_board' leads to dlt-daemon crash.
It is necessary to parse the code of the returned error in errno.
If errno = ECONNABORTED it means there was an attempt to scan port 3490
and on this error there is no need to exit the application by error.
Fix for the issue https://github.com/GENIVI/dlt-daemon/issues/341
Signed-off-by: Ruslan Valovyi <ruslan.valovyi@volvocars.com>
-rw-r--r-- | src/daemon/dlt-daemon.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index 55d5954..9678247 100644 --- a/src/daemon/dlt-daemon.c +++ b/src/daemon/dlt-daemon.c @@ -2060,6 +2060,8 @@ int dlt_daemon_process_client_connect(DltDaemon *daemon, cli_size = sizeof(cli); if ((in_sock = accept(receiver->fd, (struct sockaddr *)&cli, &cli_size)) < 0) { + if (errno == ECONNABORTED) // Caused by nmap -v -p 3490 -Pn <IP of dlt-daemon> + return 0; dlt_vlog(LOG_ERR, "accept() for socket %d failed: %s\n", receiver->fd, strerror(errno)); return -1; } |