aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-08-02 09:56:25 -0600
committerJens Axboe <axboe@kernel.dk>2022-08-02 10:09:10 -0600
commit0992b9b38fcdd6f91e19f524c199b8cd3e1cda13 (patch)
treec678ef4c84fcae4e1ec591a3ca594a41e7d69283
parent263180def3df508daf1b644f308c6689e5e06fb4 (diff)
downloadfio-io_uring-numa.tar.gz
t/io_uring: check read of home node fileio_uring-numa
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--t/io_uring.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/t/io_uring.c b/t/io_uring.c
index ea7020434..35bf19564 100644
--- a/t/io_uring.c
+++ b/t/io_uring.c
@@ -641,14 +641,18 @@ static int detect_node(struct submitter *s, const char *name)
#ifdef CONFIG_LIBNUMA
const char *base = basename(name);
char str[128];
- int fd, node;
+ int ret, fd, node;
sprintf(str, "/sys/block/%s/device/numa_node", base);
fd = open(str, O_RDONLY);
if (fd < 0)
return -1;
- read(fd, str, sizeof(str));
+ ret = read(fd, str, sizeof(str));
+ if (ret < 0) {
+ close(fd);
+ return -1;
+ }
node = atoi(str);
s->numa_node = node;
close(fd);