From 268864db4d0f94f312d60e7526bc0030a8d782bd Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 31 Dec 2006 00:02:50 +0000 Subject: [PATCH] make sigar_file2str available ifdef WIN32 --- src/sigar_util.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/sigar_util.c b/src/sigar_util.c index 23f8f820..678c4299 100644 --- a/src/sigar_util.c +++ b/src/sigar_util.c @@ -98,22 +98,6 @@ char *sigar_getword(char **line, char stop) return res; } -int sigar_file2str(const char *fname, char *buffer, int buflen) -{ - int len; - int fd = open(fname, O_RDONLY); - - if (fd < 0) { - return ENOENT; - } - - len = read(fd, buffer, buflen); - buffer[len] = '\0'; - close(fd); - - return SIGAR_OK; -} - /* avoiding sprintf */ char *sigar_proc_filename(char *buffer, int buflen, @@ -588,6 +572,22 @@ SIGAR_DECLARE(int) sigar_rpc_ping(char *host, } #endif +int sigar_file2str(const char *fname, char *buffer, int buflen) +{ + int len; + int fd = open(fname, O_RDONLY); + + if (fd < 0) { + return ENOENT; + } + + len = read(fd, buffer, buflen); + buffer[len] = '\0'; + close(fd); + + return SIGAR_OK; +} + #ifdef WIN32 #define vsnprintf _vsnprintf #endif