threads / patch / 2545

patchFix compilation of git.c

Subject: [PATCH] Fix compilation of git.c

## tl;dr

3 messages between Nov 16, 2005 and Nov 16, 2005. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Johannes Schindelin· Nov 16, 2005, 01:44 UTC · lore
Some systems do not define GLOB_ABORTED and GLOB_NOMATCH.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 git.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

applies-to: c20dc1194fcfa73a7bf6e9d315c878d4f8c2828a 57cce66195a824221c0e9517ff4999daf2fbe2d2

Show changes to git.c +4 −0
diff --git a/git.c b/git.c
index 583923d..30b3c04 100644
--- a/git.c
+++ b/git.c
@@ -77,13 +77,17 @@ static void list_commands(const char *ex
 	case GLOB_NOSPACE:
 		puts("Out of memory when running glob()");
 		exit(2);
+#ifdef GLOB_ABORTED
 	case GLOB_ABORTED:
 		printf("'%s': Read error: %s\n", exec_path, strerror(errno));
 		exit(2);
+#endif
+#ifdef GLOB_NOMATCH
 	case GLOB_NOMATCH:
 		printf("No git commands available in '%s'.\n", exec_path);
 		printf("Do you need to specify --exec-path or set GIT_EXEC_PATH?\n");
 		exit(1);
+#endif
 	}
 
 	for (i = 0; i < gl.gl_pathc; i++) {
---
0.99.9.GIT
Junio C Hamano· Nov 16, 2005, 03:01 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Fix compilation of git.c

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Some systems do not define GLOB_ABORTED and GLOB_NOMATCH.

That's true, but the glob does not distinguish executables and others anyway, do wouldn't it be more portable and easier to do readdir, stat and list in the loop?

Andreas Ericsson· Nov 16, 2005, 06:54 UTC · re: Junio C Hamano · lore

Re: [PATCH] Fix compilation of git.c

Junio C Hamano wrote:
Show 10 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> 
>>Some systems do not define GLOB_ABORTED and GLOB_NOMATCH.
> 
> 
> That's true, but the glob does not distinguish executables and
> others anyway, do wouldn't it be more portable and easier to do
> readdir, stat and list in the loop?
> 

Got one implementation of that too, but it doesn't sort the command list and I thought it was nice to have them that way while too lazy to implement myself.

OTOH, that switch/case thing was for debugging (forgot prefix=/usr when compiling...). I'm perfectly fine with

if (glob(....)) {
	error_out("friendly message");
}
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

← back to recent threads