acl/0019-read_acl_-comments-seq-switch-to-next_line.patch
Marcus Meissner 5439477a49 Accepting request 347209 from home:jeff_mahoney:branches:Base:System
- Update to git snapshot dated 21 Sep 2015.
  - Added:
    * 0001-Install-the-libraries-to-the-appropriate-directory.patch
    * 0002-setfacl.1-fix-typo-inclu-de-include.patch
    * 0003-test-fix-insufficient-quoting-of.patch
    * 0004-Makefile-rename-configure.in-to-configure.ac.patch
    * 0005-Bad-markup-in-acl.5-page.patch
    * 0006-.gitignore-ignore-and-config.h.in.patch
    * 0007-Use-autoreconf-rather-than-autoconf-to-regenerate-th.patch
    * 0008-libacl-Make-sure-that-acl_from_text-always-sets-errn.patch
    * 0009-libacl-fix-SIGSEGV-of-getfacl-e-on-overly-long-group.patch
    * 0010-punt-debian-rpm-packaging-logic.patch
    * 0011-move-gettext-logic-into-misc.h.patch
    * 0012-test-make-running-parallel-out-of-tree-safe.patch
    * 0013-modernize-build-system.patch
    * 0014-po-regenerate-files-after-move.patch
    * 0015-build-drop-aclincludedir-use-pkgincludedir.patch
    * 0016-build-make-use-of-an-aux-dir-to-stow-away-helper-scr.patch
    * 0017-build-ship-a-pkgconfig-file-for-libacl.patch
    * 0018-read_acl_-comments-seq-rename-line-to-lineno.patch
    * 0019-read_acl_-comments-seq-switch-to-next_line.patch
    * 0020-telldir-return-value-and-seekdir-second-parameters-a.patch
    * 0021-mark-libmisc-funcs-as-hidden-so-they-are-not-exporte.patch
    * 0022-add-__acl_-prefixes-to-internal-symbols.patch
    * 0023-cp.test-Check-permissions-of-the-right-file.patch
    * 0024-libacl-acl_set_file-Remove-unnecesary-racy-check.patch
    * 0025-fix-compilation-with-latest-xattr-git.patch
    * 0026-getfacl-Fix-memory-leak.patch
    * 0027-Fix-the-display-block-nesting-in-acl.5.patch
    * 0028-setfacl-man-page-Minor-wording-improvements.patch

OBS-URL: https://build.opensuse.org/request/show/347209
OBS-URL: https://build.opensuse.org/package/show/Base:System/acl?expand=0&rev=43
2015-12-03 14:58:36 +00:00

90 lines
1.9 KiB
Diff

From 34d5069ab4187aece1b711a86af705ff121ac62d Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 19 Jan 2014 01:05:11 -0500
Subject: [PATCH 19/34] read_acl_{comments,seq}: switch to next_line
Rather than use a fixed length buffer, use next_line. This let's us
handle any arbitrary length and avoid the non-portable PATH_MAX.
Fixes bug 27388 in the acl tracker.
---
tools/parse.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/tools/parse.c b/tools/parse.c
index 6f30cf5..df69c26 100644
--- a/tools/parse.c
+++ b/tools/parse.c
@@ -419,9 +419,7 @@ read_acl_comments(
bytes for "# file: ". Not a good solution but for now it is the
best I can do without too much impact on the code. [tw]
*/
- char linebuf[(4*PATH_MAX)+9];
- char *cp;
- char *p;
+ char *line, *cp, *p;
int comments_read = 0;
if (path_p)
@@ -449,19 +447,20 @@ read_acl_comments(
if (lineno)
(*lineno)++;
- if (fgets(linebuf, sizeof(linebuf), file) == NULL)
+ line = next_line(file);
+ if (line == NULL)
break;
comments_read = 1;
- p = strrchr(linebuf, '\0');
- while (p > linebuf &&
+ p = strrchr(line, '\0');
+ while (p > line &&
(*(p-1)=='\r' || *(p-1)=='\n')) {
p--;
*p = '\0';
}
- cp = linebuf;
+ cp = line;
SKIP_WS(cp);
if (strncmp(cp, "file:", 5) == 0) {
cp += 5;
@@ -542,20 +541,18 @@ read_acl_seq(
int *lineno,
int *which)
{
- char linebuf[1024];
+ char *line;
const char *cp;
cmd_t cmd;
if (which)
*which = -1;
- for(;;) {
- if (fgets(linebuf, sizeof(linebuf), file) == NULL)
- break;
+ while ((line = next_line(file))) {
if (lineno)
(*lineno)++;
- cp = linebuf;
+ cp = line;
SKIP_WS(cp);
if (*cp == '\0') {
if (!(parse_mode & SEQ_PARSE_MULTI))
@@ -588,7 +585,7 @@ read_acl_seq(
fail:
if (which)
- *which = (cp - linebuf);
+ *which = (cp - line);
return -1;
}
--
2.5.2