Re: [PATCH] entry.c: Use strerror() to print error info when possible

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] entry.c: Use strerror() to print error info when possible

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:04

"Luiz Fernando N. Capitulino" [off-list ref]
writes:
quoted hunk
Signed-off-by: Luiz Fernando N. Capitulino <redacted>
---
 entry.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/entry.c b/entry.c
index d72f811..c36c09d 100644
--- a/entry.c
+++ b/entry.c
@@ -19,7 +19,8 @@ static void create_directories(const char *path, struct checkout *state)
 				if (!stat(buf, &st) && S_ISDIR(st.st_mode))
 					continue; /* ok */
 			}
-			die("cannot create directory at %s", buf);
+			die("cannot create directory at %s (%s)", buf,
+			    strerror(errno));
 		}
 	}
 	free(buf);
This hunk is wrong; stat() you see in the context could have
been what failed the last before this die().

I do not think other places you patched do not share the issue.

Re: [PATCH] entry.c: Use strerror() to print error info when possible

From: Luiz Fernando N. Capitulino <hidden>
Date: 2016-06-15 22:43:04

Em Sun, 15 Apr 2007 15:54:47 -0700
Junio C Hamano [off-list ref] escreveu:

| "Luiz Fernando N. Capitulino" [off-list ref]
| writes:
| 
| > Signed-off-by: Luiz Fernando N. Capitulino [off-list ref]
| > ---
| >  entry.c |   11 ++++++-----
| >  1 files changed, 6 insertions(+), 5 deletions(-)
| >
| > diff --git a/entry.c b/entry.c
| > index d72f811..c36c09d 100644
| > --- a/entry.c
| > +++ b/entry.c
| > @@ -19,7 +19,8 @@ static void create_directories(const char *path, struct checkout *state)
| >  				if (!stat(buf, &st) && S_ISDIR(st.st_mode))
| >  					continue; /* ok */
| >  			}
| > -			die("cannot create directory at %s", buf);
| > +			die("cannot create directory at %s (%s)", buf,
| > +			    strerror(errno));
| >  		}
| >  	}
| >  	free(buf);
| 
| This hunk is wrong; stat() you see in the context could have
| been what failed the last before this die().

 You right, will try to read the code more carefully before
patching.

| I do not think other places you patched do not share the issue.

 Other places seems ok, I'll review and re-send along with other
patches I'm working on.

 Thanks a lot for the feedback.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help