pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/libnbcompat/files pass const empty string to ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/810adb962064
branches:  trunk
changeset: 503303:810adb962064
user:      grant <grant%pkgsrc.org@localhost>
date:      Fri Nov 18 03:31:11 2005 +0000

description:
pass const empty string to MAKEEXTRALIST macro instead of the
anonymous empty string. the macro uses the argument multiple times
and the logic relies on identical strings having the same address,
which is compiler dependent and not guaranteed to be the case.

problem observed with pax(1) built with sunpro 11 on Solaris.

from segv%netctl.net@localhost in PR pkg/32097.

diffstat:

 pkgtools/libnbcompat/files/vis.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (52 lines):

diff -r 24f244154430 -r 810adb962064 pkgtools/libnbcompat/files/vis.c
--- a/pkgtools/libnbcompat/files/vis.c  Fri Nov 18 01:08:39 2005 +0000
+++ b/pkgtools/libnbcompat/files/vis.c  Fri Nov 18 03:31:11 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vis.c,v 1.7 2004/08/23 03:32:13 jlam Exp $     */
+/*     $NetBSD: vis.c,v 1.8 2005/11/18 03:31:11 grant Exp $    */
 
 /*-
  * Copyright (c) 1989, 1993
@@ -68,7 +68,7 @@
 #include <nbcompat.h>
 #include <nbcompat/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.7 2004/08/23 03:32:13 jlam Exp $");
+__RCSID("$NetBSD: vis.c,v 1.8 2005/11/18 03:31:11 grant Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #if 0
@@ -329,10 +329,11 @@
 
 {
        char *extra;
+       const char *emptystr = "";
 
        _DIAGASSERT(dst != NULL);
 
-       MAKEEXTRALIST(flag, extra, "");
+       MAKEEXTRALIST(flag, extra, emptystr);
        if (flag & VIS_HTTPSTYLE)
                HVIS(dst, c, flag, nextc, extra);
        else
@@ -359,8 +360,9 @@
        int flag;
 {
        char *extra;
+       const char *emptystr = "";
 
-       MAKEEXTRALIST(flag, extra, "");
+       MAKEEXTRALIST(flag, extra, emptystr);
        return (strsvis(dst, src, flag, extra));
 }
 
@@ -373,7 +375,8 @@
        int flag;
 {
        char *extra;
+       const char *emptystr = "";
 
-       MAKEEXTRALIST(flag, extra, "");
+       MAKEEXTRALIST(flag, extra, emptystr);
        return (strsvisx(dst, src, len, flag, extra));
 }



Home | Main Index | Thread Index | Old Index