The branch, master has been updated
via c74ef7a waf: Mark the replacement zlib private so that it can build
on machine without a system zlib
via 4ea7d46 replace: use replace for non 'samba' compliant strptime
via 2d0ac59 replace: use a wrapper around strtoll if it didn't behave
as expected
from c529317 Lowercase socket_wrapper name.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c74ef7acf49f5e447373643c2e28c1dad56f451d
Author: Matthieu Patou <[email protected]>
Date: Fri Oct 22 01:01:53 2010 +0400
waf: Mark the replacement zlib private so that it can build on machine
without a system zlib
Autobuild-User: Matthieu Patou <[email protected]>
Autobuild-Date: Thu Oct 21 21:47:46 UTC 2010 on sn-devel-104
commit 4ea7d4694a8353fc55ecd12cb09b9c91ffde7b3f
Author: Matthieu Patou <[email protected]>
Date: Thu Oct 21 02:14:39 2010 +0400
replace: use replace for non 'samba' compliant strptime
commit 2d0ac59fcc490517b202180f49b178ab80c2534e
Author: Matthieu Patou <[email protected]>
Date: Thu Oct 21 00:13:54 2010 +0400
replace: use a wrapper around strtoll if it didn't behave as expected
-----------------------------------------------------------------------
Summary of changes:
lib/replace/replace.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++-
lib/replace/replace.h | 12 +++++++++++
lib/replace/wscript | 36 +++++++++++++++++++++++++++++++++++
lib/zlib/wscript | 1 +
4 files changed, 97 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index a00f705..5ecda92 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -3,6 +3,7 @@
replacement routines for broken systems
Copyright (C) Andrew Tridgell 1992-1998
Copyright (C) Jelmer Vernooij 2005-2008
+ Copyright (C) Matthieu Patou 2010
** NOTE! The following LGPL license applies to the replace
** library. This does NOT imply that all of Samba is released
@@ -502,6 +503,7 @@ char *rep_strtok_r(char *s, const char *delim, char
**save_ptr)
}
#endif
+
#ifndef HAVE_STRTOLL
long long int rep_strtoll(const char *str, char **endptr, int base)
{
@@ -515,7 +517,29 @@ long long int rep_strtoll(const char *str, char **endptr,
int base)
# error "You need a strtoll function"
#endif
}
-#endif
+#else
+#ifdef HAVE_BSD_STRTOLL
+#ifdef HAVE_STRTOQ
+long long int rep_strtoll(const char *str, char **endptr, int base)
+{
+ long long int nb = strtoq(str, endptr, base);
+ /* In linux EINVAL is only returned if base is not ok */
+ if (errno == EINVAL) {
+ if (base == 0 || (base >1 && base <37)) {
+ /* Base was ok so it's because we were not
+ * able to make the convertion.
+ * Let's reset errno.
+ */
+ errno = 0;
+ }
+ }
+ return nb;
+}
+#else
+#error "You need the strtoq function"
+#endif /* HAVE_STRTOQ */
+#endif /* HAVE_BSD_STRTOLL */
+#endif /* HAVE_STRTOLL */
#ifndef HAVE_STRTOULL
@@ -531,7 +555,29 @@ unsigned long long int rep_strtoull(const char *str, char
**endptr, int base)
# error "You need a strtoull function"
#endif
}
-#endif
+#else
+#ifdef HAVE_BSD_STRTOLL
+#ifdef HAVE_STRTOUQ
+long long int rep_strtoull(const char *str, char **endptr, int base)
+{
+ unsigned long long int nb = strtouq(str, endptr, base);
+ /* In linux EINVAL is only returned if base is not ok */
+ if (errno == EINVAL) {
+ if (base == 0 || (base >1 && base <37)) {
+ /* Base was ok so it's because we were not
+ * able to make the convertion.
+ * Let's reset errno.
+ */
+ errno = 0;
+ }
+ }
+ return nb;
+}
+#else
+#error "You need the strtouq function"
+#endif /* HAVE_STRTOUQ */
+#endif /* HAVE_BSD_STRTOLL */
+#endif /* HAVE_STRTOULL */
#ifndef HAVE_SETENV
int rep_setenv(const char *name, const char *value, int overwrite)
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index 10c7ee7..8f820a9 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -283,14 +283,26 @@ char *rep_strcasestr(const char *haystack, const char
*needle);
char *rep_strtok_r(char *s, const char *delim, char **save_ptr);
#endif
+
+
#ifndef HAVE_STRTOLL
+long long int rep_strtoll(const char *str, char **endptr, int base);
#define strtoll rep_strtoll
+#else
+#ifdef HAVE_BSD_STRTOLL
long long int rep_strtoll(const char *str, char **endptr, int base);
+#define strtoll rep_strtoll
+#endif
#endif
#ifndef HAVE_STRTOULL
#define strtoull rep_strtoull
unsigned long long int rep_strtoull(const char *str, char **endptr, int base);
+#else
+#ifdef HAVE_BSD_STRTOLL
+long long int rep_strtoull(const char *str, char **endptr, int base);
+#define strtoull rep_strtoull
+#endif
#endif
#ifndef HAVE_FTRUNCATE
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 48871d6..95cbb37 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -160,6 +160,23 @@ def configure(conf):
conf.CHECK_FUNCS('link readlink symlink realpath snprintf vsnprintf')
conf.CHECK_FUNCS('asprintf vasprintf setenv unsetenv strnlen strtoull
__strtoull')
conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq')
+ #Some OS (ie. freebsd) return EINVAL if the convertion could not be done,
it's not what we expect
+ #Let's detect those cases
+ if conf.CONFIG_SET('HAVE_STRTOLL'):
+ conf.CHECK_CODE('''
+ long long nb = strtoll("Text", NULL, 0);
+ if (errno == EINVAL) {
+ return 0;
+ } else {
+ return 1;
+ }
+ ''',
+ msg="Checking correct behavior of strtoll",
+ headers = 'errno.h',
+ execute = True,
+ define_ret = True,
+ define = 'HAVE_BSD_STRTOLL',
+ )
conf.CHECK_FUNCS('if_nametoindex strerror_r')
conf.CHECK_FUNCS('getdirentries getdents syslog')
conf.CHECK_FUNCS('gai_strerror get_current_dir_name')
@@ -212,6 +229,25 @@ def configure(conf):
addmain=False,
msg='Checking for working strptime'):
conf.DEFINE('REPLACE_STRPTIME', 1)
+ else:
+ conf.CHECK_CODE('''
+ const char *s = "20070414101546Z";
+ char *ret;
+ struct tm t;
+ memset(&t, 0, sizeof(t));
+ ret = strptime(s, "%Y%m%d%H%M%S", &t);
+ if (ret == NULL || t.tm_wday != 6) {
+ return 0;
+ } else {
+ return 1;
+ }
+ ''',
+ msg="Checking correct behavior of strptime",
+ headers = 'time.h',
+ execute = True,
+ define_ret = True,
+ define = 'REPLACE_STRPTIME',
+ )
if conf.CONFIG_SET('HAVE_KRB5_H'):
# Check for KRB5_DEPRECATED handling
diff --git a/lib/zlib/wscript b/lib/zlib/wscript
index 6f0d4f7..c16dc4c 100644
--- a/lib/zlib/wscript
+++ b/lib/zlib/wscript
@@ -20,6 +20,7 @@ def build(bld):
bld.TARGET_ALIAS('z', 'ZLIB')
else:
bld.SAMBA_LIBRARY('ZLIB',
+ private_library=True,
deps='replace',
source='''adler32.c compress.c crc32.c gzio.c
uncompr.c deflate.c trees.c zutil.c
--
Samba Shared Repository