Introduce remove_or_warn function
This patch introduces the remove_or_warn function which is a generalised version of the {unlink,rmdir}_or_warn functions. It takes an additional parameter indicating the mode of the file to be removed. The patch also modifies certain functions to use remove_or_warn where appropriate, and adds a test case for a bug fixed by the use of remove_or_warn. Signed-off-by: Peter Collingbourne <peter@pcc.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
d1723296af
commit
80d706afed
@ -473,5 +473,10 @@ int unlink_or_warn(const char *path);
|
||||
* Likewise for rmdir(2).
|
||||
*/
|
||||
int rmdir_or_warn(const char *path);
|
||||
/*
|
||||
* Calls the correct function out of {unlink,rmdir}_or_warn based on
|
||||
* the supplied file mode.
|
||||
*/
|
||||
int remove_or_warn(unsigned int mode, const char *path);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user