From 6b2d87eef41a3cee1dccca431dc4575fe4ce5cef Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Fri, 7 Jun 2024 12:27:29 +0200 Subject: move read_file_at to util.c --- mdstat.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'mdstat.c') diff --git a/mdstat.c b/mdstat.c index bc8b62a..d2567a4 100644 --- a/mdstat.c +++ b/mdstat.c @@ -19,24 +19,6 @@ const struct collector mdstat_collector = { .collect = mdstat_collect, }; -static ssize_t -read_file_at(int dirfd, char *pathname, char *buf, size_t bufsiz) { - int fd = openat(dirfd, pathname, O_RDONLY); - if (fd < 0) - return -1; - - ssize_t r = read(fd, buf, bufsiz - 1); - close(fd); - if (r < 0) - return -1; - - if (buf[r-1] == '\n') - r--; - - buf[r] = 0; - return r; -} - void scrape_write_md_label(scrape_req *req, char *name, char *md, char *label, char *value, double d) { struct label labels[] = { -- cgit 1.4.1