From 3c49db45b53377cd485959cac6509d8ca4483a3d Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sat, 6 Apr 2013 08:27:14 -0400 Subject: [PATCH] More checks for limits.h and LINE_MAX. --- src/err.c | 14 ++++++++++++++ src/modules/login.c | 11 +++++++++++ src/modules/mail.c | 7 +++++++ src/modules/passwd.c | 7 +++++++ src/ui.c | 11 +++++++++++ 5 files changed, 50 insertions(+) diff --git a/src/err.c b/src/err.c index 699b80d..744f664 100644 --- a/src/err.c +++ b/src/err.c @@ -15,10 +15,24 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include + +#ifdef HAVE_LIMITS_H #include +#ifndef LINE_MAX +#ifdef _POSIX2_LINE_MAX +#define LINE_MAX _POSIX2_LINE_MAX +#else +#define LINE_MAX 2048 +#endif +#endif +#endif #define err(eval, fmt, ...) print_string(eval, 1, fmt, ## __VA_ARGS__) #define errx(eval, fmt, ...) print_string(eval, 0, fmt, ## __VA_ARGS__) diff --git a/src/modules/login.c b/src/modules/login.c index b2cbccf..77964ca 100644 --- a/src/modules/login.c +++ b/src/modules/login.c @@ -29,6 +29,17 @@ #include #include +#ifdef HAVE_LIMITS_H +#include +#ifndef LINE_MAX +#ifdef _POSIX2_LINE_MAX +#define LINE_MAX _POSIX2_LINE_MAX +#else +#define LINE_MAX 2048 +#endif +#endif +#endif + #ifndef HAVE_STRSEP #include "../strsep.c" #endif diff --git a/src/modules/mail.c b/src/modules/mail.c index e82cfd7..23c13dc 100644 --- a/src/modules/mail.c +++ b/src/modules/mail.c @@ -37,6 +37,13 @@ #ifdef HAVE_LIMITS_H #include +#ifndef LINE_MAX +#ifdef _POSIX2_LINE_MAX +#define LINE_MAX _POSIX2_LINE_MAX +#else +#define LINE_MAX 2048 +#endif +#endif #endif #ifdef HAVE_SYS_MMAN_H diff --git a/src/modules/passwd.c b/src/modules/passwd.c index 7c6029d..6c6be87 100644 --- a/src/modules/passwd.c +++ b/src/modules/passwd.c @@ -30,6 +30,13 @@ #ifdef HAVE_LIMITS_H #include +#ifndef LINE_MAX +#ifdef _POSIX2_LINE_MAX +#define LINE_MAX _POSIX2_LINE_MAX +#else +#define LINE_MAX 2048 +#endif +#endif #endif #ifdef HAVE_GETOPT_H diff --git a/src/ui.c b/src/ui.c index 89b3219..3e26fdb 100644 --- a/src/ui.c +++ b/src/ui.c @@ -29,6 +29,17 @@ #include #include +#ifdef HAVE_LIMITS_H +#include +#ifndef LINE_MAX +#ifdef _POSIX2_LINE_MAX +#define LINE_MAX _POSIX2_LINE_MAX +#else +#define LINE_MAX 2048 +#endif +#endif +#endif + #ifdef HAVE_GETOPT_H #include #endif -- 2.11.4.GIT