All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] entry.c: Use strerror() to print error info when possible
@ 2007-04-15 21:56 Luiz Fernando N. Capitulino
  2007-04-15 22:54 ` Junio C Hamano
  2007-04-15 23:00 ` Alex Riesen
  0 siblings, 2 replies; 5+ messages in thread
From: Luiz Fernando N. Capitulino @ 2007-04-15 21:56 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List


Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
---
 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);
@@ -33,7 +34,7 @@ static void remove_subtree(const char *path)
 	char *name;
 	
 	if (!dir)
-		die("cannot opendir %s", path);
+		die("cannot opendir %s (%s)", path, strerror(errno));
 	strcpy(pathbuf, path);
 	name = pathbuf + strlen(path);
 	*name++ = '/';
@@ -45,15 +46,15 @@ static void remove_subtree(const char *path)
 			continue;
 		strcpy(name, de->d_name);
 		if (lstat(pathbuf, &st))
-			die("cannot lstat %s", pathbuf);
+			die("cannot lstat %s (%s)", pathbuf, strerror(errno));
 		if (S_ISDIR(st.st_mode))
 			remove_subtree(pathbuf);
 		else if (unlink(pathbuf))
-			die("cannot unlink %s", pathbuf);
+			die("cannot unlink %s (%s)", pathbuf, strerror(errno));
 	}
 	closedir(dir);
 	if (rmdir(path))
-		die("cannot rmdir %s", path);
+		die("cannot rmdir %s (%s)", path, strerror(errno));
 }
 
 static int create_file(const char *path, unsigned int mode)
-- 
1.5.1.1.85.geed2-dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-15 23:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-15 21:56 [PATCH] entry.c: Use strerror() to print error info when possible Luiz Fernando N. Capitulino
2007-04-15 22:54 ` Junio C Hamano
2007-04-15 23:54   ` Luiz Fernando N. Capitulino
2007-04-15 23:00 ` Alex Riesen
2007-04-15 23:57   ` Luiz Fernando N. Capitulino

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.