Source-Changes-HG archive

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

[src/trunk]: src/lib/libintl allow relative pathnames as a dirname argument o...



details:   https://anonhg.NetBSD.org/src/rev/81943af3c195
branches:  trunk
changeset: 519016:81943af3c195
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sun Dec 09 11:11:01 2001 +0000

description:
allow relative pathnames as a dirname argument of bindtextdomain(3)
since some autoconf configure scripts depends on this behavior.

diffstat:

 lib/libintl/gettext.c    |  18 ++++++++++++++++--
 lib/libintl/textdomain.c |   7 +++++--
 2 files changed, 21 insertions(+), 4 deletions(-)

diffs (70 lines):

diff -r 91fa25b50a2a -r 81943af3c195 lib/libintl/gettext.c
--- a/lib/libintl/gettext.c     Sun Dec 09 07:52:20 2001 +0000
+++ b/lib/libintl/gettext.c     Sun Dec 09 11:11:01 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gettext.c,v 1.10 2001/09/27 15:29:06 yamt Exp $        */
+/*     $NetBSD: gettext.c,v 1.11 2001/12/09 11:11:01 yamt Exp $        */
 
 /*-
  * Copyright (c) 2000, 2001 Citrus Project,
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: gettext.c,v 1.10 2001/09/27 15:29:06 yamt Exp $");
+__RCSID("$NetBSD: gettext.c,v 1.11 2001/12/09 11:11:01 yamt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -587,6 +587,20 @@
                db = __bindings;
        }
 
+       /* resolve relative path */
+       /* XXX not necessary? */
+       if (db->path[0] != '/') {
+               char buf[PATH_MAX];
+
+               if (getcwd(buf, sizeof(buf)) == 0)
+                       goto fail;
+               if (strlcat(buf, "/", sizeof(buf)) >= sizeof(buf))
+                       goto fail;
+               if (strlcat(buf, db->path, sizeof(buf)) >= sizeof(buf))
+                       goto fail;
+               strcpy(db->path, buf);
+       }
+
        /* don't bother looking it up if the values are the same */
        if (odomainname && strcmp(domainname, odomainname) == 0 &&
            ocname && strcmp(cname, ocname) == 0 && strcmp(lpath, olpath) == 0 &&
diff -r 91fa25b50a2a -r 81943af3c195 lib/libintl/textdomain.c
--- a/lib/libintl/textdomain.c  Sun Dec 09 07:52:20 2001 +0000
+++ b/lib/libintl/textdomain.c  Sun Dec 09 11:11:01 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: textdomain.c,v 1.5 2001/02/16 07:20:35 minoura Exp $   */
+/*     $NetBSD: textdomain.c,v 1.6 2001/12/09 11:11:01 yamt Exp $      */
 
 /*-
  * Copyright (c) 2000, 2001 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: textdomain.c,v 1.5 2001/02/16 07:20:35 minoura Exp $");
+__RCSID("$NetBSD: textdomain.c,v 1.6 2001/12/09 11:11:01 yamt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -83,9 +83,12 @@
 
        if (strlen(dirname) + 1 > sizeof(p->path))
                return NULL;
+
+#if 0
        /* disallow relative path */
        if (dirname[0] != '/')
                return NULL;
+#endif
 
        if (strlen(domainname) + 1 > sizeof(p->domainname))
                return NULL;



Home | Main Index | Thread Index | Old Index