mirror of https://github.com/getdnsapi/getdns.git
PATH_MAX can be in sys/limits.h too..
and must have a fallback value
This commit is contained in:
parent
a86e21b48a
commit
c3df13b27c
16
configure.ac
16
configure.ac
|
@ -1224,7 +1224,7 @@ dnl ----- Start of "Things needed for gldns" section
|
||||||
dnl -----
|
dnl -----
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
|
|
||||||
AC_CHECK_HEADERS([stdarg.h stdint.h netinet/in.h arpa/inet.h netdb.h sys/socket.h time.h sys/time.h sys/select.h endian.h],,, [AC_INCLUDES_DEFAULT])
|
AC_CHECK_HEADERS([stdarg.h stdint.h netinet/in.h arpa/inet.h netdb.h sys/socket.h time.h sys/time.h sys/select.h endian.h limits.h sys/limits.h],,, [AC_INCLUDES_DEFAULT])
|
||||||
|
|
||||||
dnl Check the printf-format attribute (if any)
|
dnl Check the printf-format attribute (if any)
|
||||||
dnl result in HAVE_ATTR_FORMAT.
|
dnl result in HAVE_ATTR_FORMAT.
|
||||||
|
@ -1498,6 +1498,20 @@ static inline int _gldns_custom_vsnprintf(char *str, size_t size, const char *fo
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_LIMITS_H
|
||||||
|
#include <sys/limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PATH_MAX
|
||||||
|
#define _GETDNS_PATH_MAX PATH_MAX
|
||||||
|
#else
|
||||||
|
#define _GETDNS_PATH_MAX 2048
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PRIu64
|
#ifndef PRIu64
|
||||||
#define PRIu64 "llu"
|
#define PRIu64 "llu"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3777,7 +3777,7 @@ _get_context_settings(getdns_context* context)
|
||||||
getdns_list *list;
|
getdns_list *list;
|
||||||
size_t i;
|
size_t i;
|
||||||
const char *str_value;
|
const char *str_value;
|
||||||
char appdata_dir[PATH_MAX] = "";
|
char appdata_dir[_GETDNS_PATH_MAX] = "";
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -4691,7 +4691,7 @@ static size_t _getdns_get_appdata(getdns_context *context, char *path)
|
||||||
DEBUG_ANCHOR("ERROR %s(): Could not get %%AppData%% directory\n"
|
DEBUG_ANCHOR("ERROR %s(): Could not get %%AppData%% directory\n"
|
||||||
, __FUNC__);
|
, __FUNC__);
|
||||||
|
|
||||||
else if ((len = strlen(path)) + sizeof(APPDATA_SUBDIR) + 2 >= PATH_MAX)
|
else if ((len = strlen(path)) + sizeof(APPDATA_SUBDIR) + 2 >= _GETDNS_PATH_MAX)
|
||||||
DEBUG_ANCHOR("ERROR %s(): Home path too long for appdata\n"
|
DEBUG_ANCHOR("ERROR %s(): Home path too long for appdata\n"
|
||||||
, __FUNC__);
|
, __FUNC__);
|
||||||
#else
|
#else
|
||||||
|
@ -4708,7 +4708,7 @@ static size_t _getdns_get_appdata(getdns_context *context, char *path)
|
||||||
DEBUG_ANCHOR("ERROR %s(): Could not get home directory\n"
|
DEBUG_ANCHOR("ERROR %s(): Could not get home directory\n"
|
||||||
, __FUNC__);
|
, __FUNC__);
|
||||||
|
|
||||||
else if ((len = strlen(home)) + sizeof(APPDATA_SUBDIR) + 2 >= PATH_MAX)
|
else if ((len = strlen(home)) + sizeof(APPDATA_SUBDIR) + 2 >= _GETDNS_PATH_MAX)
|
||||||
DEBUG_ANCHOR("ERROR %s(): Home path too long for appdata\n"
|
DEBUG_ANCHOR("ERROR %s(): Home path too long for appdata\n"
|
||||||
, __FUNC__);
|
, __FUNC__);
|
||||||
|
|
||||||
|
@ -4748,7 +4748,7 @@ static size_t _getdns_get_appdata(getdns_context *context, char *path)
|
||||||
|
|
||||||
FILE *_getdns_context_get_priv_fp(getdns_context *context, const char *fn)
|
FILE *_getdns_context_get_priv_fp(getdns_context *context, const char *fn)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX];
|
char path[_GETDNS_PATH_MAX];
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
@ -4814,7 +4814,7 @@ uint8_t *_getdns_context_get_priv_file(getdns_context *context,
|
||||||
int _getdns_context_write_priv_file(getdns_context *context,
|
int _getdns_context_write_priv_file(getdns_context *context,
|
||||||
const char *fn, getdns_bindata *content)
|
const char *fn, getdns_bindata *content)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX], tmpfn[PATH_MAX];
|
char path[_GETDNS_PATH_MAX], tmpfn[_GETDNS_PATH_MAX];
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -4870,7 +4870,7 @@ int _getdns_context_write_priv_file(getdns_context *context,
|
||||||
|
|
||||||
int _getdns_context_can_write_appdata(getdns_context *context)
|
int _getdns_context_can_write_appdata(getdns_context *context)
|
||||||
{
|
{
|
||||||
char test_fn[30], path[PATH_MAX];
|
char test_fn[30], path[_GETDNS_PATH_MAX];
|
||||||
size_t len;
|
size_t len;
|
||||||
getdns_bindata test_content = { 4, (void *)"TEST" };
|
getdns_bindata test_content = { 4, (void *)"TEST" };
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue