pkgsrc/devel/idutils/patches/patch-aj
mef 00b0d75796 (pkgsrc)
- Add two patches, to avoid
   error: incompatible types when assigning to type '__off_t' from type 'fpos_t'
   fp_->_offset = u.f;
  - Remove one patch patch-af, which had a comment, not necessary for now
    " also look in *.mk files as makefiles.  bump pkg revision."
(upstream)
  - Update 4.2 to 4.6
    ----------------------
* Noteworthy changes in release 4.6 (2012-02-03) [stable]

** Bug fixes
  - lid -L no longer mishandles open-ended ranges like "..2" and "2.."
  - lid's -d, -o and -x options now work properly

* Noteworthy changes in release 4.5 (2010-06-17) [stable]
* Noteworthy changes in release 4.4 (2009-10-30) [beta]
                        ------------
** New features
  mkid and xtokid accept a new option --files0-from=FILE, to make them
  process only the files named in FILE.  FILE must contain a list of
  NUL-terminated file names.

** Bug fixes
  mkid and xtokid now accept language specific options via the command line.

* Noteworthy changes in release 4.3.92 (2008-10-18) [beta]
                        --------------
** Bug fixes

  fid: avoid a buffer overrun
  handle failed allocation, e.g., by strdup
  avoid potential realloc overflow
  mkid: avoid an infloop on some .el files
  all programs: detect write error on stdout

** Miscellaneous improvements

  revamp code and infrastructure, bringing it closer to coreutils' standards
  add automatically-generated man pages
  mkid recognize more suffixes: .ac, .mk, .bz2, .lzma.
  idutils is now licensed under the General Public License version 3
    or later (GPLv3+).
2014-12-15 11:35:42 +00:00

71 lines
1.9 KiB
Text

$NetBSD: patch-aj,v 1.4 2014/12/15 11:35:42 mef Exp $
--- src/lid.c.orig 2012-01-31 21:22:05.000000000 +0900
+++ src/lid.c 2014-11-20 23:12:39.000000000 +0900
@@ -32,7 +32,6 @@
#include <dirname.h>
#include <unistd.h>
#include <termios.h>
-#include <alloca.h>
#include <regex.h>
#include <xalloc.h>
#include <pathmax.h>
@@ -562,10 +561,11 @@ report_filenames (char const *name, stru
static void
report_grep (char const *name, struct file_link **flinkv)
{
- char line[1<<020];
+ char *line = xmalloc(BUFSIZ);
+ size_t line_len = BUFSIZ;
char const *pattern = 0;
regex_t compiled;
- char *file_name = alloca (PATH_MAX);
+ char file_name[PATH_MAX];
if (key_style == ks_pattern)
{
@@ -597,8 +597,17 @@ report_grep (char const *name, struct fi
continue;
}
- while (fgets (line + 1, sizeof (line) - 1, source_FILE))
+ while (fgets (line + 1, line_len - 1, source_FILE))
{
+ size_t len;
+ while ((len = strlen(line)) == line_len - 1 &&
+ line[line_len - 2] != '\n')
+ {
+ line = xrealloc(line, line_len + BUFSIZ);
+ line_len += BUFSIZ;
+ if (fgets(line + len, BUFSIZ, source_FILE) == NULL)
+ break;
+ }
line_number++;
if (pattern)
{
@@ -614,6 +623,7 @@ report_grep (char const *name, struct fi
}
fclose (source_FILE);
}
+ free(line);
}
static char **
@@ -826,7 +836,7 @@ search_flinkv (struct file_link **flinkv
{
char pattern[BUFSIZ];
unsigned int count;
- char *file_name = alloca (PATH_MAX);
+ char file_name[PATH_MAX];
char *eol;
if (fgets (pattern, sizeof (pattern), stdin) == 0)
@@ -1305,7 +1315,7 @@ word_match (char const *name_0, char con
continue;
}
/* march down both strings as long as we match */
- while (*++name == *++line)
+ while (*name != '\0' && *++name == *++line)
;
/* is this the end of `name', is there a word delimiter ?? */
if (*name == '\0' && !IS_ALNUM (*line))