summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 11fd0bc)
raw | patch | inline | side by side (parent: 11fd0bc)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Tue, 4 Jul 2017 09:14:05 +0000 (16:14 +0700) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Wed, 11 Oct 2017 07:33:09 +0000 (14:33 +0700) |
The `swrite()` can return positive value from `errno` in case of error.
src/mcelog.c | patch | blob | history | |
src/multimeter.c | patch | blob | history | |
src/ntpd.c | patch | blob | history | |
src/ted.c | patch | blob | history | |
src/write_tsdb.c | patch | blob | history |
diff --git a/src/mcelog.c b/src/mcelog.c
index 6b10b04cf7098b2b1ec404f8fb58ac7ba96a73d0..ae5a7f549646b85bf72dfa25d3c9ead7e55e687e 100644 (file)
--- a/src/mcelog.c
+++ b/src/mcelog.c
const size_t len) {
int ret = 0;
pthread_rwlock_rdlock(&self->lock);
- if (swrite(self->sock_fd, msg, len) < 0)
+ if (swrite(self->sock_fd, msg, len) != 0)
ret = -1;
pthread_rwlock_unlock(&self->lock);
return ret;
diff --git a/src/multimeter.c b/src/multimeter.c
index 72b0fed91c1f32caab8ec7b2846389d70031b513..fc69e02dd4ac1aff8fa4a19e4e7eb199c1212bca 100644 (file)
--- a/src/multimeter.c
+++ b/src/multimeter.c
struct timeval time_now;
status = swrite(fd, "D", 1);
- if (status < 0) {
+ if (status != 0) {
ERROR("multimeter plugin: swrite failed.");
return -1;
}
diff --git a/src/ntpd.c b/src/ntpd.c
index 48d7aa7209b29b6675fba8fbc26f8697095475b3..0faf2a2a1a461c427b77177926989286e6e25eb4 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
(void *)req_data);
status = swrite(sd, (const char *)&req, REQ_LEN_NOMAC);
- if (status < 0) {
+ if (status != 0) {
DEBUG("`swrite' failed. Closing socket #%i", sd);
close(sd);
sock_descr = sd = -1;
diff --git a/src/ted.c b/src/ted.c
index 94b4e3ab4b6dc9112282969b509d852627dbad74..3b64b75fe2c1ba859535614be60b0a598aeffc49 100644 (file)
--- a/src/ted.c
+++ b/src/ted.c
status = write(fd, pkt_request, sizeof(pkt_request));
if (status <= 0) {
- ERROR("ted plugin: swrite failed.");
+ ERROR("ted plugin: write failed.");
return -1;
}
diff --git a/src/write_tsdb.c b/src/write_tsdb.c
index 10f636c5aad5afa936eb862d3c2c0feb7322ebaa..eb6ceb3f668dfb1129491147eb286c2ccd140211 100644 (file)
--- a/src/write_tsdb.c
+++ b/src/write_tsdb.c
ssize_t status = 0;
status = swrite(cb->sock_fd, cb->send_buf, strlen(cb->send_buf));
- if (status < 0) {
+ if (status != 0) {
char errbuf[1024];
ERROR("write_tsdb plugin: send failed with status %zi (%s)", status,
sstrerror(errno, errbuf, sizeof(errbuf)));