@matheusbsbs / matheus-bagliano / commits / cc2903fc70
Fork 0

remove_subtree(): Use strerror() when possible

Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Junio C Hamano <junkio@cox.net>

Luiz Fernando N. Capitulino committed Apr 25, 2007 at 11:17 UTC cc2903fc70ea9e1bb7788a6f5f46b5d3dd1b6fe4
1 file changed +4 -4
entry.c
+4 -4
@@ -33,7 +33,7 @@ static void remove_subtree(const char *path)
33 char *name;
34
35 if (!dir)
36 - die("cannot opendir %s", path);
36 + die("cannot opendir %s (%s)", path, strerror(errno));
37 strcpy(pathbuf, path);
38 name = pathbuf + strlen(path);
39 *name++ = '/';
@@ -45,15 +45,15 @@ static void remove_subtree(const char *path)
45 continue;
46 strcpy(name, de->d_name);
47 if (lstat(pathbuf, &st))
48 - die("cannot lstat %s", pathbuf);
48 + die("cannot lstat %s (%s)", pathbuf, strerror(errno));
49 if (S_ISDIR(st.st_mode))
50 remove_subtree(pathbuf);
51 else if (unlink(pathbuf))
52 - die("cannot unlink %s", pathbuf);
52 + die("cannot unlink %s (%s)", pathbuf, strerror(errno));
53 }
54 closedir(dir);
55 if (rmdir(path))
56 - die("cannot rmdir %s", path);
56 + die("cannot rmdir %s (%s)", path, strerror(errno));
57 }
58
59 static int create_file(const char *path, unsigned int mode)