From: koreth@midwinter.com
To: Alex Riesen <raa.lkml@gmail.com>
Cc: git@vger.kernel.org
Subject: [PATCH] Use PATH_MAX rather than a hardwired constant maximum length.
Date: Thu, 26 Apr 2007 02:12:54 -0700 [thread overview]
Message-ID: <20070426091254.GA23586@midwinter.com> (raw)
In-Reply-To: <46306A29.4010608@midwinter.com>
Signed-off-by: Steven Grimm <koreth@midwinter.com>
---
Is the +1 really needed? The existing code is doing this in other places
but I'm not sure it's necessary since we're also doing sizeof(buffer)-1
in the getcwd() call. I figured it was best to be consistent with the
existing code, e.g. setup_git_directory_gently().
setup.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup.c b/setup.c
index a45ea83..84d3c4a 100644
--- a/setup.c
+++ b/setup.c
@@ -175,11 +175,11 @@ static int inside_git_dir = -1;
int is_inside_git_dir(void)
{
if (inside_git_dir < 0) {
- char buffer[1024];
+ char buffer[PATH_MAX+1];
if (is_bare_repository())
return (inside_git_dir = 1);
- if (getcwd(buffer, sizeof(buffer))) {
+ if (getcwd(buffer, sizeof(buffer)-1)) {
const char *git_dir = get_git_dir(), *cwd = buffer;
while (*git_dir && *git_dir == *cwd) {
git_dir++;
--
1.5.2.rc0.35.gf41c8
next prev parent reply other threads:[~2007-04-26 9:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-25 23:28 [PATCH] Change git-rev-parse --show-cdup to output an absolute path koreth
2007-04-26 8:20 ` Alex Riesen
2007-04-26 9:00 ` Steven Grimm
2007-04-26 9:12 ` koreth [this message]
2007-04-26 12:14 ` [PATCH] Use PATH_MAX rather than a hardwired constant maximum length Alex Riesen
2007-04-26 11:57 ` [PATCH] Change git-rev-parse --show-cdup to output an absolute path Alex Riesen
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=20070426091254.GA23586@midwinter.com \
--to=koreth@midwinter.com \
--cc=git@vger.kernel.org \
--cc=raa.lkml@gmail.com \
/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).