From: Wolfgang Stöggl Date: Tue, 15 Jan 2019 09:44:39 +0000 (+0100) Subject: Define realpath for MinGW builds X-Git-Tag: v1.7.1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f2982f7af36fa3ae6198ecf0bb44379cbe812c6;p=thirdparty%2Frrdtool-1.x.git Define realpath for MinGW builds - Define realpath the same way as in win32/rrd_config.h - Fixes the following compiler warnings in rrd_client.c: 115:11: warning: implicit declaration of function 'realpath'; [-Wimplicit-function-declaration] ret = realpath(path, NULL); 115:11: warning: nested extern declaration of 'realpath' [-Wnested-externs] 115:9: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion] ret = realpath(path, NULL); 132:22: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion] dir_path = realpath(dir, NULL); --- diff --git a/src/rrd_client.c b/src/rrd_client.c index c7ea2ee8..2b5b6f7b 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -38,6 +38,10 @@ #endif +#ifdef __MINGW32__ +#define realpath(N,R) _fullpath((R),(N),_MAX_PATH) +#endif + #include "rrd_strtod.h" #include "rrd.h" #include "rrd_tool.h" @@ -103,11 +107,9 @@ static char *get_path(rrd_client_t *client, const char *path) /* {{{ */ if ((client == NULL) || (path == NULL) || (client->sd_path == NULL)) return (NULL); -#ifndef __MINGW32__ if ((*client->sd_path == '/') || (strncmp ("unix:", client->sd_path, strlen ("unix:")) == 0)) is_unix = 1; -#endif if (is_unix) {