dir = opendir(dirname);
if (!dir) {
+#if DEBUG
fprintf(stderr, "%s: failed to open %s: %s\n", __func__, dirname, strerror(errno));
+#endif
return false;
}
ret = lstat(pathname, &mystat);
if (ret) {
+#if DEBUG
fprintf(stderr, "%s: failed to stat %s: %s\n", __func__, pathname, strerror(errno));
+#endif
continue;
}
if (S_ISDIR(mystat.st_mode)) {
- if (!recursive_rmdir(pathname))
+ if (!recursive_rmdir(pathname)) {
+#if DEBUG
fprintf(stderr, "Error removing %s\n", pathname);
+#endif
+ }
}
}
}
if (rmdir(dirname) < 0) {
+#if DEBUG
fprintf(stderr, "%s: failed to delete %s: %s\n", __func__, dirname, strerror(errno));
+#endif
ret = false;
}