[SSSD] [Freeipa-devel] [PATCH] add configure check for errno_t
Sumit Bose
sbose at redhat.com
Wed Aug 26 11:25:15 UTC 2009
On Mon, Jul 27, 2009 at 09:53:23AM -0400, Stephen Gallagher wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 07/24/2009 05:05 PM, Sumit Bose wrote:
> > Hi,
> >
> > we regular use functions returning errno error code like ENOMEN or
> > EINVAL. The return type of these functions is usually int. To underline
> > that the return code is only an error code and should not be used
> > otherwise a special type can be used. There is the ISO/ICE technical
> > report 24731-1 which recommends they type errno_t for this purpose. I
> > think it makes sense to stick with this recommendation (and I hope
> > people don't mind that the same TR also recommends the not so smart *_s
> > replacements for most of the standard libc functions).
> >
> > The attached patch add a configure check for errno_t and defines it if
> > not present in the system.
> >
> > bye,
> > Sumit
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Freeipa-devel mailing list
> > Freeipa-devel at redhat.com
> > https://www.redhat.com/mailman/listinfo/freeipa-devel
>
> Nack.
>
> Please include a patch that modifies the configure scripts of the
> sss_client and common directories.
>
I have include the check in the sss_client directory, but I'm reluctant
to add it to common, too. IMO the maintainers of the packages should
decide if errno_t makes sense for them or not. A second argument would
be that in most cases there is no private header file where the typedef
can be added.
bye,
Sumit
-------------- next part --------------
>From 43d76a38e907f3d7cc3e7cbdd5695286de3b08de Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Wed, 26 Aug 2009 13:18:19 +0200
Subject: [PATCH] add configure check for errno_t
---
server/configure.ac | 2 ++
server/util/util.h | 4 ++++
sss_client/configure.ac | 2 ++
sss_client/sss_cli.h | 4 ++++
4 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/server/configure.ac b/server/configure.ac
index d42f07e..071ad07 100644
--- a/server/configure.ac
+++ b/server/configure.ac
@@ -31,6 +31,8 @@ AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes])
AC_CHECK_HEADERS(stdint.h dlfcn.h)
AC_CONFIG_HEADER(config.h)
+AC_CHECK_TYPES([errno_t], [], [], [[#include <errno.h>]])
+
m4_include([build_macros.m4])
BUILD_WITH_SHARED_BUILD_DIR
diff --git a/server/util/util.h b/server/util/util.h
index 8796529..e312341 100644
--- a/server/util/util.h
+++ b/server/util/util.h
@@ -15,6 +15,10 @@
#include "tevent.h"
#include "ldb.h"
+#ifndef HAVE_ERRNO_T
+typedef int errno_t;
+#endif
+
extern const char *debug_prg_name;
extern int debug_level;
extern int debug_timestamps;
diff --git a/sss_client/configure.ac b/sss_client/configure.ac
index df16641..01c717d 100644
--- a/sss_client/configure.ac
+++ b/sss_client/configure.ac
@@ -13,6 +13,8 @@ AM_GNU_GETTEXT_VERSION([0.14])
AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes])
+AC_CHECK_TYPES([errno_t], [], [], [[#include <errno.h>]])
+
m4_pattern_allow([AM_SILENT_RULES])
AM_SILENT_RULES
diff --git a/sss_client/sss_cli.h b/sss_client/sss_cli.h
index f1ccba9..857a1cd 100644
--- a/sss_client/sss_cli.h
+++ b/sss_client/sss_cli.h
@@ -15,6 +15,10 @@
#include <pwd.h>
#include <grp.h>
+#ifndef HAVE_ERRNO_T
+typedef int errno_t;
+#endif
+
#define SSS_NSS_PROTOCOL_VERSION 1
#define SSS_PAM_PROTOCOL_VERSION 2
--
1.6.2.5
More information about the sssd-devel
mailing list