diff options
Diffstat (limited to 'misc/less/patches/patch-ab')
-rw-r--r-- | misc/less/patches/patch-ab | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/misc/less/patches/patch-ab b/misc/less/patches/patch-ab new file mode 100644 index 00000000000..e4c1d7eefae --- /dev/null +++ b/misc/less/patches/patch-ab @@ -0,0 +1,46 @@ +$NetBSD: patch-ab,v 1.1 2006/09/27 11:28:32 taca Exp $ + +--- tags.c.orig 2004-02-04 13:52:27.000000000 +0900 ++++ tags.c +@@ -498,7 +498,7 @@ findgtag(tag, type) + #if !HAVE_POPEN + return TAG_NOFILE; + #else +- char command[512]; ++ char *command; + char *flag; + char *qtag; + char *cmd = lgetenv("LESSGLOBALTAGS"); +@@ -528,10 +528,13 @@ findgtag(tag, type) + qtag = shell_quote(tag); + if (qtag == NULL) + qtag = tag; ++ command = (char *)ecalloc(strlen(cmd) + strlen(flag) + ++ strlen(qtag) + 5, sizeof(char)); + sprintf(command, "%s -x%s %s", cmd, flag, qtag); + if (qtag != tag) + free(qtag); + fp = popen(command, "r"); ++ free(command); + #endif + } + if (fp != NULL) +@@ -539,6 +542,7 @@ findgtag(tag, type) + while (fgets(buf, sizeof(buf), fp)) + { + char *name, *file, *line; ++ size_t len; + + if (sigs) + { +@@ -548,8 +552,8 @@ findgtag(tag, type) + #endif + return TAG_INTR; + } +- if (buf[strlen(buf) - 1] == '\n') +- buf[strlen(buf) - 1] = 0; ++ if ((len = strlen(buf)) && buf[len - 1] == '\n') ++ buf[len - 1] = 0; + else + { + int c; |