From 22cbf2df435b2390a09a5bc5392bbd32ae184671 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Fri, 15 Jul 2011 10:02:14 -0600 Subject: [PATCH] better patch for missing gnulib getdtablesize function in 1.4 upstream --- debian/patches/getdtablesize-missing.diff | 104 ++++++++++------------ 1 file changed, 45 insertions(+), 59 deletions(-) diff --git a/debian/patches/getdtablesize-missing.diff b/debian/patches/getdtablesize-missing.diff index 46839c4..2a34a2f 100644 --- a/debian/patches/getdtablesize-missing.diff +++ b/debian/patches/getdtablesize-missing.diff @@ -1,11 +1,35 @@ +diff --git a/configure.ac b/configure.ac +index 818dbd9..0919132 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -129,6 +129,12 @@ if test "$gl_gcc_warnings" = yes; then + AC_SUBST([GNULIB_WARN_CFLAGS]) + fi + ++gl_FUNC_GETDTABLESIZE ++if test $HAVE_GETDTABLESIZE = 0; then ++ AC_LIBOBJ([getdtablesize]) ++fi ++gl_UNISTD_MODULE_INDICATOR([getdtablesize]) ++ + # cc -E produces incorrect asm files on SVR4, so postprocess it. + ASCPPPOST="sed '/^ *#/d; s,//.*,,; s/% /%/g; s/\\. /./g'" + AC_SUBST([ASCPPPOST]) +diff --git a/debian/patches/series b/debian/patches/series +index f008915..6015402 100644 +--- a/debian/patches/series ++++ b/debian/patches/series +@@ -1,2 +1 @@ +-getdtablesize-missing.diff + zless-LESSOPEN.diff diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c new file mode 100644 -index 0000000..a565a2d +index 0000000..60e7f5a --- /dev/null -+++ b/gzip/lib/getdtablesize.c ++++ b/lib/getdtablesize.c @@ -0,0 +1,63 @@ +/* getdtablesize() function for platforms that don't have it. -+ Copyright (C) 2008-2010 Free Software Foundation, Inc. ++ Copyright (C) 2008-2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2008. + + This program is free software: you can redistribute it and/or modify @@ -67,14 +91,26 @@ index 0000000..a565a2d +} + +#endif -diff --git a/gzip/m4/getdtablesize.m4 b/gzip/m4/getdtablesize.m4 +diff --git a/m4/.gitignore b/m4/.gitignore +index a5c3278..e03f2bc 100644 +--- a/m4/.gitignore ++++ b/m4/.gitignore +@@ -1,7 +1,6 @@ + /asm-underscore.m4 + /cloexec.m4 + /configmake.m4 +-/getdtablesize.m4 + /gnulib-comp.m4 + /gnulib-tool.m4 + /wchar_h.m4 +diff --git a/m4/getdtablesize.m4 b/m4/getdtablesize.m4 new file mode 100644 -index 0000000..d238628 +index 0000000..40a598b --- /dev/null -+++ b/gzip/m4/getdtablesize.m4 -@@ -0,0 +1,15 @@ -+# getdtablesize.m4 serial 1 -+dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. ++++ b/m4/getdtablesize.m4 +@@ -0,0 +1,14 @@ ++# getdtablesize.m4 serial 2 ++dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. @@ -85,55 +121,5 @@ index 0000000..d238628 + AC_CHECK_FUNCS_ONCE([getdtablesize]) + if test $ac_cv_func_getdtablesize != yes; then + HAVE_GETDTABLESIZE=0 -+ AC_LIBOBJ([getdtablesize]) + fi +]) -diff --git a/lib/gnulib.mk b/lib/gnulib.mk -index bb79c0d..0a22af3 100644 ---- a/lib/gnulib.mk -+++ b/lib/gnulib.mk -@@ -548,6 +548,14 @@ EXTRA_libgzip_a_SOURCES += getcwd.c - - ## end gnulib module getcwd - -+## begin gnulib module getdtablesize -+ -+EXTRA_DIST += getdtablesize.c -+ -+EXTRA_libgzip_a_SOURCES += getdtablesize.c -+ -+## end gnulib module getdtablesize -+ - ## begin gnulib module getopt-posix - - BUILT_SOURCES += $(GETOPT_H) -diff --git a/lib/unistd.in.h b/lib/unistd.in.h -index bffdf8f..21cf667 100644 ---- a/lib/unistd.in.h -+++ b/lib/unistd.in.h -@@ -423,17 +423,19 @@ extern int getdomainname(char *name, size_t len) _GL_ARG_NONNULL ((1)); - - - #if @GNULIB_GETDTABLESIZE@ --# if !@HAVE_GETDTABLESIZE@ - /* Return the maximum number of file descriptors in the current process. - In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ --extern int getdtablesize (void); -+# if !@HAVE_GETDTABLESIZE@ -+_GL_FUNCDECL_SYS (getdtablesize, int, (void)); - # endif -+_GL_CXXALIAS_SYS (getdtablesize, int, (void)); -+_GL_CXXALIASWARN (getdtablesize); - #elif defined GNULIB_POSIXCHECK - # undef getdtablesize --# define getdtablesize() \ -- (GL_LINK_WARNING ("getdtablesize is unportable - " \ -- "use gnulib module getdtablesize for portability"), \ -- getdtablesize ()) -+# if HAVE_RAW_DECL_GETDTABLESIZE -+_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " -+ "use gnulib module getdtablesize for portability"); -+# endif - #endif - - -- 2.30.2