From: Dmitry Potapov <dpotapov@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>, git@vger.kernel.org
Cc: Dmitry Potapov <dpotapov@gmail.com>
Subject: [PATCH] error out if path is invalid
Date: Sun, 5 Oct 2008 06:14:41 +0400 [thread overview]
Message-ID: <1223172881-4948-2-git-send-email-dpotapov@gmail.com> (raw)
In-Reply-To: <1223172881-4948-1-git-send-email-dpotapov@gmail.com>
Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
---
builtin-update-index.c | 2 +-
read-cache.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 417f972..3a2291b 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -218,7 +218,7 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1,
struct cache_entry *ce;
if (!verify_path(path))
- return -1;
+ return error("Invalid path '%s'", path);
len = strlen(path);
size = cache_entry_size(len);
diff --git a/read-cache.c b/read-cache.c
index 972592e..43dc338 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -591,8 +591,10 @@ struct cache_entry *make_cache_entry(unsigned int mode,
int size, len;
struct cache_entry *ce;
- if (!verify_path(path))
+ if (!verify_path(path)) {
+ error("Invalid path '%s'", path);
return NULL;
+ }
len = strlen(path);
size = cache_entry_size(len);
@@ -884,7 +886,7 @@ static int add_index_entry_with_check(struct index_state *istate, struct cache_e
if (!ok_to_add)
return -1;
if (!verify_path(ce->name))
- return -1;
+ return error("Invalid path '%s'", ce->name);
if (!skip_df_check &&
check_file_directory_conflict(istate, ce, pos, ok_to_replace)) {
--
1.6.0
next prev parent reply other threads:[~2008-10-05 2:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-05 0:40 [PATCH] make prefix_path() never return NULL Dmitry Potapov
2008-10-05 2:14 ` [PATCH] do not segfault if make_cache_entry failed Dmitry Potapov
2008-10-05 2:14 ` Dmitry Potapov [this message]
2008-10-06 7:02 ` [PATCH] error out if path is invalid Johannes Sixt
2008-10-07 0:22 ` Dmitry Potapov
2008-10-07 6:03 ` Johannes Sixt
2008-10-11 16:39 ` [PATCH] print an error message for invalid path Dmitry Potapov
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=1223172881-4948-2-git-send-email-dpotapov@gmail.com \
--to=dpotapov@gmail.com \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.