summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 77425c1)
raw | patch | inline | side by side (parent: 77425c1)
author | Florian Forster <octo@collectd.org> | |
Tue, 8 Dec 2015 11:51:29 +0000 (12:51 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Tue, 8 Dec 2015 11:51:32 +0000 (12:51 +0100) |
This removes the assumption that accept() returning a socket (success)
implies that errno is not equal to EINTR. This is probably a reasonable
assumption, but trips up Coverity may be a bit hard to read.
CID: 38009
implies that errno is not equal to EINTR. This is probably a reasonable
assumption, but trips up Coverity may be a bit hard to read.
CID: 38009
src/email.c | patch | blob | history |
diff --git a/src/email.c b/src/email.c
index 7493cc6d6967bc07255d7fb91a12bb5a6039974b..6a1350f9edab96782d504409a2958263b59839a1 100644 (file)
--- a/src/email.c
+++ b/src/email.c
pthread_mutex_unlock (&available_mutex);
- do {
+ while (42) {
errno = 0;
- if (-1 == (remote = accept (connector_socket, NULL, NULL))) {
- if (EINTR != errno) {
- char errbuf[1024];
- disabled = 1;
- close (connector_socket);
- connector_socket = -1;
- log_err ("accept() failed: %s",
- sstrerror (errno, errbuf, sizeof (errbuf)));
- pthread_exit ((void *)1);
- }
+
+ remote = accept (connector_socket, NULL, NULL);
+ if (remote == -1) {
+ char errbuf[1024];
+
+ if (errno == EINTR)
+ continue;
+
+ disabled = 1;
+ close (connector_socket);
+ connector_socket = -1;
+ log_err ("accept() failed: %s",
+ sstrerror (errno, errbuf, sizeof (errbuf)));
+ pthread_exit ((void *)1);
}
- } while (EINTR == errno);
+
+ /* access() succeeded. */
+ break;
+ }
connection = malloc (sizeof (*connection));
if (connection != NULL)