diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-07-26 05:25:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-07-26 05:25:24 +0000 |
commit | acf73199fa227b97217238334236af367c8ab2d7 (patch) | |
tree | b6812bd6cbe6b977884ec94def20de59555983d5 /examples/telemetry-listen.c | |
parent | Adding upstream version 1.0. (diff) | |
download | libnvme-acf73199fa227b97217238334236af367c8ab2d7.tar.xz libnvme-acf73199fa227b97217238334236af367c8ab2d7.zip |
Adding upstream version 1.1~rc0.upstream/1.1_rc0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | examples/telemetry-listen.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/telemetry-listen.c b/examples/telemetry-listen.c index 746992b..ec5edb3 100644 --- a/examples/telemetry-listen.c +++ b/examples/telemetry-listen.c @@ -55,7 +55,6 @@ static void save_telemetry(nvme_ctrl_t c) free(log); return; } - log_size = (le16_to_cpu(log->dalb3) + 1) * NVME_LOG_TELEM_BLOCK_SIZE; fd = open(buf, O_CREAT|O_WRONLY, S_IRUSR|S_IRGRP); if (fd < 0) { @@ -67,7 +66,7 @@ static void save_telemetry(nvme_ctrl_t c) if (ret < 0) printf("failed to write telemetry log\n"); else - printf("telemetry log save as %s, wrote:%d size:%ld\n", buf, + printf("telemetry log save as %s, wrote:%d size:%zd\n", buf, ret, log_size); close(fd); free(log); @@ -77,8 +76,10 @@ static void check_telemetry(nvme_ctrl_t c, int ufd) { char buf[0x1000] = { 0 }; char *p, *ptr; + int len; - if (read(ufd, buf, sizeof(buf)) < 0) + len = read(ufd, buf, sizeof(buf) - 1); + if (len < 0) return; ptr = buf; @@ -140,7 +141,7 @@ int main() nvme_subsystem_for_each_ctrl(s, c) i++; - e = calloc(i, sizeof(e)); + e = calloc(i, sizeof(struct events)); FD_ZERO(&fds); i = 0; |