[PATCH 5/5] Support systems which do not have nl_langinfo()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a configure check and skip use of nl_langinfo if it is not
present.

Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
---
 configure.ac | 1 +
 warnquota.c  | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index d17b18c..0d0ba57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,7 @@ PKG_PROG_PKG_CONFIG([0.20])
 
 AC_C_CONST
 AC_C_INLINE
+AC_CHECK_FUNC(nl_langinfo)
 
 # ===============
 # Gettext support
diff --git a/warnquota.c b/warnquota.c
index e9868c1..0d911e4 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -30,7 +30,9 @@
 #include <time.h>
 #include <getopt.h>
 #include <locale.h>
+#ifdef HAVE_NL_LANGINFO
 #include <langinfo.h>
+#endif
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/utsname.h>
@@ -723,10 +725,12 @@ static int readconfigfile(const char *filename, struct configparams *config)
 	(config->charset)[0] = '\0';
 	setlocale(LC_ALL, NULL);
 	locale = setlocale(LC_MESSAGES, NULL);
+#ifdef HAVE_NL_LANGINFO
 	if (locale && strcasecmp(locale, "posix") && strcasecmp(locale, "c")) {
 		locale = nl_langinfo(CODESET);
 		sstrncpy(config->charset, locale, CNF_BUFFER);
 	}
+#endif
 	maildev[0] = 0;
 	config->user_signature = config->user_message = config->group_signature = config->group_message = NULL;
 	config->cc_before = -1;
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux