]> rtime.felk.cvut.cz Git - git.git/commitdiff
Implement the rmdir_or_warn function
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 26 Mar 2010 15:25:33 +0000 (15:25 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 28 Mar 2010 16:53:01 +0000 (09:53 -0700)
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>
git-compat-util.h
wrapper.c

index a3c45373669cd8482c04d5815862ed36a153572d..67ea4c89f5f9db58bf5bf5dcde9d76e6fc511475 100644 (file)
@@ -469,5 +469,9 @@ void git_qsort(void *base, size_t nmemb, size_t size,
  * Always returns the return value of unlink(2).
  */
 int unlink_or_warn(const char *path);
+/*
+ * Likewise for rmdir(2).
+ */
+int rmdir_or_warn(const char *path);
 
 #endif
index 0bbff56e2c38651b10551d17caeed84e0cc250c8..4017bff6bb3f658ed745da4f9a3a7a79fb38fb08 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -328,3 +328,8 @@ int unlink_or_warn(const char *file)
 {
        return warn_if_unremovable("unlink", file, unlink(file));
 }
+
+int rmdir_or_warn(const char *file)
+{
+       return warn_if_unremovable("rmdir", file, rmdir(file));
+}