Christian Weisgerber <[EMAIL PROTECTED]> wrote:

> I would really appreciate some eyes on patch-gettext-runtime_intl_\
> localcharset_c.  The idea is to remove all unsafe function linker
> warnings from libintl itself, because so many ports link to it.
> (I'll also take a look at libiconv to this effect.)

And here's the corresponding libiconv patch (plus some minor cleanup),
which actually re-uses two patches from gettext.


Index: Makefile
===================================================================
RCS file: /cvs/ports/converters/libiconv/Makefile,v
retrieving revision 1.26
diff -u -r1.26 Makefile
--- Makefile    28 Oct 2006 11:19:20 -0000      1.26
+++ Makefile    2 Aug 2007 15:20:48 -0000
@@ -3,7 +3,7 @@
 COMMENT=       "character set conversion library"
 
 DISTNAME=      libiconv-1.9.2
-PKGNAME=       ${DISTNAME}p3
+PKGNAME=       ${DISTNAME}p4
 CATEGORIES=    converters devel
 MASTER_SITES=  ${MASTER_SITE_GNU:=libiconv/}
 SHARED_LIBS += charset              1.0      # .1.0
@@ -11,7 +11,7 @@
 
 HOMEPAGE=      http://www.gnu.org/software/libiconv/
 
-MAINTAINER=    Brad Smith <[EMAIL PROTECTED]>
+MAINTAINER=    Brad Smith <[EMAIL PROTECTED]>
 
 # LGPL
 PERMIT_PACKAGE_CDROM=  Yes
Index: patches/patch-autoconf_ltmain_sh
===================================================================
RCS file: patches/patch-autoconf_ltmain_sh
diff -N patches/patch-autoconf_ltmain_sh
--- patches/patch-autoconf_ltmain_sh    24 Dec 2003 00:08:02 -0000      1.8
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,62 +0,0 @@
-$OpenBSD: patch-autoconf_ltmain_sh,v 1.8 2003/12/24 00:08:02 brad Exp $
---- autoconf/ltmain.sh.orig    2003-04-15 19:22:56.000000000 -0400
-+++ autoconf/ltmain.sh 2003-12-21 13:36:54.000000000 -0500
-@@ -668,8 +668,6 @@ EOF
-       if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
-         exit $status
-       fi
--      $show "chmod 777 ${xdir}$objdir"
--      $run chmod 777 ${xdir}$objdir
-       fi
- 
-       if test -z "$output_obj"; then
-@@ -1696,8 +1694,6 @@ EOF
-       if test "$status" -ne 0 && test ! -d "$output_objdir"; then
-       exit $status
-       fi
--      $show "chmod 777 $output_objdir"
--      $run chmod 777 $output_objdir
-     fi
- 
-     # Determine the type of output
-@@ -5700,40 +5696,6 @@ relink_command=\"$relink_command\""
-     # Exit here if they wanted silent mode.
-     test "$show" = : && exit 0
- 
--    $echo 
"----------------------------------------------------------------------"
--    $echo "Libraries have been installed in:"
--    for libdir in $libdirs; do
--      $echo "   $libdir"
--    done
--    $echo
--    $echo "If you ever happen to want to link against installed libraries"
--    $echo "in a given directory, LIBDIR, you must either use libtool, and"
--    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
--    $echo "flag during linking and do at least one of the following:"
--    if test -n "$shlibpath_var"; then
--      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
--      $echo "     during execution"
--    fi
--    if test -n "$runpath_var"; then
--      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
--      $echo "     during linking"
--    fi
--    if test -n "$hardcode_libdir_flag_spec"; then
--      libdir=LIBDIR
--      eval flag=\"$hardcode_libdir_flag_spec\"
--
--      $echo "   - use the \`$flag' linker flag"
--    fi
--    if test -n "$admincmds"; then
--      $echo "   - have your system administrator run these 
commands:$admincmds"
--    fi
--    if test -f /etc/ld.so.conf; then
--      $echo "   - have your system administrator add LIBDIR to 
\`/etc/ld.so.conf'"
--    fi
--    $echo
--    $echo "See any operating system documentation about shared libraries for"
--    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
--    $echo 
"----------------------------------------------------------------------"
-     exit 0
-     ;;
- 
Index: patches/patch-lib_Makefile_in
===================================================================
RCS file: /cvs/ports/converters/libiconv/patches/patch-lib_Makefile_in,v
retrieving revision 1.9
diff -u -r1.9 patch-lib_Makefile_in
--- patches/patch-lib_Makefile_in       24 Dec 2005 16:11:52 -0000      1.9
+++ patches/patch-lib_Makefile_in       2 Aug 2007 15:20:48 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-lib_Makefile_in,v 1.9 2005/12/24 16:11:52 espie Exp $
 --- lib/Makefile.in.orig       Sun May 18 16:19:16 2003
-+++ lib/Makefile.in    Sat Dec 24 17:04:04 2005
-@@ -26,7 +26,7 @@ LIBTOOL_COMPILE = $(LIBTOOL) --mode=comp
++++ lib/Makefile.in    Wed Aug  1 18:35:06 2007
+@@ -26,7 +26,7 @@ LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
  LIBTOOL_LINK = $(LIBTOOL) --mode=link
  LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
  LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
@@ -10,7 +10,7 @@
  MV = mv
  LN = @LN@
  LN_S = @LN_S@
-@@ -55,8 +55,10 @@ OBJECTS = iconv.lo localcharset.lo reloc
+@@ -55,8 +55,10 @@ OBJECTS = iconv.lo localcharset.lo relocatable.lo
  
  all : @PLUGLIB@ libiconv.la
  
Index: patches/patch-lib_iconv_c
===================================================================
RCS file: /cvs/ports/converters/libiconv/patches/patch-lib_iconv_c,v
retrieving revision 1.1
diff -u -r1.1 patch-lib_iconv_c
--- patches/patch-lib_iconv_c   16 Apr 2005 21:10:22 -0000      1.1
+++ patches/patch-lib_iconv_c   2 Aug 2007 15:20:48 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-lib_iconv_c,v 1.1 2005/04/16 21:10:22 espie Exp $
---- lib/iconv.c.orig   Mon Apr 11 12:05:11 2005
-+++ lib/iconv.c        Mon Apr 11 12:05:30 2005
-@@ -406,7 +406,7 @@ iconv_t iconv_open (const char* tocode, 
+--- lib/iconv.c.orig   Thu May 22 21:17:40 2003
++++ lib/iconv.c        Wed Aug  1 18:35:03 2007
+@@ -406,7 +406,7 @@ iconv_t iconv_open (const char* tocode, const char* fr
    /* Initialize additional fields. */
    if (from_wchar != to_wchar) {
      struct wchar_conv_struct * wcd = (struct wchar_conv_struct *) cd;
Index: patches/patch-lib_relocatable_c
===================================================================
RCS file: patches/patch-lib_relocatable_c
diff -N patches/patch-lib_relocatable_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_relocatable_c     2 Aug 2007 15:20:48 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+--- lib/relocatable.c.orig     Fri Aug  1 18:24:10 2003
++++ lib/relocatable.c  Wed Aug  1 19:31:16 2007
+@@ -429,15 +429,19 @@ relocate (const char *pathname)
+       {
+         /* pathname starts with orig_prefix.  */
+         const char *pathname_tail = &pathname[orig_prefix_len];
+-        char *result =
+-          (char *) xmalloc (curr_prefix_len + strlen (pathname_tail) + 1);
++        size_t len;
++        char *result;
++        
++        len = curr_prefix_len + strlen (pathname_tail) + 1;
++        result = (char *) xmalloc (len);
+ 
+ #ifdef NO_XMALLOC
+         if (result != NULL)
+ #endif
+           {
+             memcpy (result, curr_prefix, curr_prefix_len);
+-            strcpy (result + curr_prefix_len, pathname_tail);
++            result[curr_prefix_len] = '\0';
++            strlcat (result, pathname_tail, len);
+             return result;
+           }
+       }
Index: patches/patch-libcharset_autoconf_ltmain_sh
===================================================================
RCS file: patches/patch-libcharset_autoconf_ltmain_sh
diff -N patches/patch-libcharset_autoconf_ltmain_sh
--- patches/patch-libcharset_autoconf_ltmain_sh 24 Dec 2003 00:08:02 -0000      
1.8
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,62 +0,0 @@
-$OpenBSD: patch-libcharset_autoconf_ltmain_sh,v 1.8 2003/12/24 00:08:02 brad 
Exp $
---- libcharset/autoconf/ltmain.sh.orig 2003-04-15 19:22:56.000000000 -0400
-+++ libcharset/autoconf/ltmain.sh      2003-12-21 13:36:54.000000000 -0500
-@@ -668,8 +668,6 @@ EOF
-       if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
-         exit $status
-       fi
--      $show "chmod 777 ${xdir}$objdir"
--      $run chmod 777 ${xdir}$objdir
-       fi
- 
-       if test -z "$output_obj"; then
-@@ -1696,8 +1694,6 @@ EOF
-       if test "$status" -ne 0 && test ! -d "$output_objdir"; then
-       exit $status
-       fi
--      $show "chmod 777 $output_objdir"
--      $run chmod 777 $output_objdir
-     fi
- 
-     # Determine the type of output
-@@ -5700,40 +5696,6 @@ relink_command=\"$relink_command\""
-     # Exit here if they wanted silent mode.
-     test "$show" = : && exit 0
- 
--    $echo 
"----------------------------------------------------------------------"
--    $echo "Libraries have been installed in:"
--    for libdir in $libdirs; do
--      $echo "   $libdir"
--    done
--    $echo
--    $echo "If you ever happen to want to link against installed libraries"
--    $echo "in a given directory, LIBDIR, you must either use libtool, and"
--    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
--    $echo "flag during linking and do at least one of the following:"
--    if test -n "$shlibpath_var"; then
--      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
--      $echo "     during execution"
--    fi
--    if test -n "$runpath_var"; then
--      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
--      $echo "     during linking"
--    fi
--    if test -n "$hardcode_libdir_flag_spec"; then
--      libdir=LIBDIR
--      eval flag=\"$hardcode_libdir_flag_spec\"
--
--      $echo "   - use the \`$flag' linker flag"
--    fi
--    if test -n "$admincmds"; then
--      $echo "   - have your system administrator run these 
commands:$admincmds"
--    fi
--    if test -f /etc/ld.so.conf; then
--      $echo "   - have your system administrator add LIBDIR to 
\`/etc/ld.so.conf'"
--    fi
--    $echo
--    $echo "See any operating system documentation about shared libraries for"
--    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
--    $echo 
"----------------------------------------------------------------------"
-     exit 0
-     ;;
- 
Index: patches/patch-libcharset_lib_Makefile_in
===================================================================
RCS file: 
/cvs/ports/converters/libiconv/patches/patch-libcharset_lib_Makefile_in,v
retrieving revision 1.6
diff -u -r1.6 patch-libcharset_lib_Makefile_in
--- patches/patch-libcharset_lib_Makefile_in    24 Dec 2005 16:11:52 -0000      
1.6
+++ patches/patch-libcharset_lib_Makefile_in    2 Aug 2007 15:20:48 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-libcharset_lib_Makefile_in,v 1.6 2005/12/24 16:11:52 espie Exp 
$
 --- libcharset/lib/Makefile.in.orig    Mon Apr 14 15:51:06 2003
-+++ libcharset/lib/Makefile.in Sat Dec 24 17:03:18 2005
-@@ -26,6 +26,7 @@ LIBTOOL_COMPILE = $(LIBTOOL) --mode=comp
++++ libcharset/lib/Makefile.in Wed Aug  1 18:35:06 2007
+@@ -26,6 +26,7 @@ LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
  LIBTOOL_LINK = $(LIBTOOL) --mode=link
  LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
  LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
Index: patches/patch-libcharset_lib_localcharset_c
===================================================================
RCS file: patches/patch-libcharset_lib_localcharset_c
diff -N patches/patch-libcharset_lib_localcharset_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-libcharset_lib_localcharset_c 2 Aug 2007 15:20:48 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+--- libcharset/lib/localcharset.c.orig Fri Jun 27 14:08:47 2003
++++ libcharset/lib/localcharset.c      Wed Aug  1 19:32:53 2007
+@@ -186,8 +186,9 @@ get_charset_aliases ()
+                 res_size = 0;
+                 break;
+               }
+-            strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1);
+-            strcpy (res_ptr + res_size - (l2 + 1), buf2);
++            strlcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1,
++              l1 + 1 + l2 + 1 + 1);
++            strlcpy (res_ptr + res_size - (l2 + 1), buf2, l2 + 1 + 1);
+           }
+         fclose (fp);
+         if (res_size == 0)
-- 
Christian "naddy" Weisgerber                          [EMAIL PROTECTED]

Reply via email to