git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Julliard <julliard@winehq.org>
To: git@vger.kernel.org
Subject: [PATCH] ls-files: Don't require exclude files to end with a newline.
Date: Sat, 18 Mar 2006 11:27:45 +0100	[thread overview]
Message-ID: <8764mccaji.fsf@wine.dyndns.org> (raw)

Without this patch, the last line of an exclude file is silently
ignored if it doesn't end with a newline.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

---

 ls-files.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

9c5a78851bcf3b541364f818f6b397c29a8f4592
diff --git a/ls-files.c b/ls-files.c
index df25c8c..e42119c 100644
--- a/ls-files.c
+++ b/ls-files.c
@@ -92,11 +92,12 @@ static int add_excludes_from_file_1(cons
 		close(fd);
 		return 0;
 	}
-	buf = xmalloc(size);
+	buf = xmalloc(size+1);
 	if (read(fd, buf, size) != size)
 		goto err;
 	close(fd);
 
+	buf[size++] = '\n';
 	entry = buf;
 	for (i = 0; i < size; i++) {
 		if (buf[i] == '\n') {
-- 
1.2.4.g5a1f-dirty

-- 
Alexandre Julliard
julliard@winehq.org

             reply	other threads:[~2006-03-18 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-18 10:27 Alexandre Julliard [this message]
2006-03-19 21:29 ` [PATCH] ls-files: Don't require exclude files to end with a newline Petr Baudis
2006-03-20  9:14   ` Alexandre Julliard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8764mccaji.fsf@wine.dyndns.org \
    --to=julliard@winehq.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).