Implement the rmdir_or_warn function
This patch implements an rmdir_or_warn function (like unlink_or_warn but for directories) that uses the generalised warning code in warn_if_unremovable. Signed-off-by: Peter Collingbourne <peter@pcc.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Peter Collingbourne committed
Mar 26, 2010 at 15:25 UTC
d1723296af67e6bbadf6e73cd1e921aefafe491f
2 files changed
+9
git-compat-util.h
+4
@@ -469,5 +469,9 @@ void git_qsort(void *base, size_t nmemb, size_t size,
469
* Always returns the return value of unlink(2).
470
*/
471
int unlink_or_warn(const char *path);
472
+/*
473
+ * Likewise for rmdir(2).
474
+ */
475
+int rmdir_or_warn(const char *path);
476
477
#endif
wrapper.c
+5
@@ -328,3 +328,8 @@ int unlink_or_warn(const char *file)
328
{
329
return warn_if_unremovable("unlink", file, unlink(file));
330
}
331
+
332
+int rmdir_or_warn(const char *file)
333
+{
334
+ return warn_if_unremovable("rmdir", file, rmdir(file));
335
+}