Skip to content

Commit d172329

Browse files
pccgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 10e13ec commit d172329

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

git-compat-util.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,5 +469,9 @@ void git_qsort(void *base, size_t nmemb, size_t size,
469469
* Always returns the return value of unlink(2).
470470
*/
471471
int unlink_or_warn(const char *path);
472+
/*
473+
* Likewise for rmdir(2).
474+
*/
475+
int rmdir_or_warn(const char *path);
472476

473477
#endif

wrapper.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,8 @@ int unlink_or_warn(const char *file)
328328
{
329329
return warn_if_unremovable("unlink", file, unlink(file));
330330
}
331+
332+
int rmdir_or_warn(const char *file)
333+
{
334+
return warn_if_unremovable("rmdir", file, rmdir(file));
335+
}

0 commit comments

Comments
 (0)