diff options
author | Alex Riesen <raa.lkml@gmail.com> | 2009-04-29 23:22:56 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-04-29 18:37:41 -0700 |
commit | 691f1a28bf57618d8b44a193b1d28013c858aba6 (patch) | |
tree | 7d404656089320d486f658d3f4c061cd13dff556 /builtin-apply.c | |
parent | fc71db39e0d75e8a403f36f3fecf4450886cd165 (diff) | |
download | git-691f1a28bf57618d8b44a193b1d28013c858aba6.tar.gz |
replace direct calls to unlink(2) with unlink_or_warn
This helps to notice when something's going wrong, especially on
systems which lock open files.
I used the following criteria when selecting the code for replacement:
- it was already printing a warning for the unlink failures
- it is in a function which already printing something or is
called from such a function
- it is in a static function, returning void and the function is only
called from a builtin main function (cmd_)
- it is in a function which handles emergency exit (signal handlers)
- it is in a function which is obvously cleaning up the lockfiles
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-apply.c')
-rw-r--r-- | builtin-apply.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-apply.c b/builtin-apply.c index 7b404ef660..8a3771e87e 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -2781,7 +2781,7 @@ static void remove_file(struct patch *patch, int rmdir_empty) if (rmdir(patch->old_name)) warning("unable to remove submodule %s", patch->old_name); - } else if (!unlink(patch->old_name) && rmdir_empty) { + } else if (!unlink_or_warn(patch->old_name) && rmdir_empty) { remove_path(patch->old_name); } } @@ -2891,7 +2891,7 @@ static void create_one_file(char *path, unsigned mode, const char *buf, unsigned if (!try_create_file(newpath, mode, buf, size)) { if (!rename(newpath, path)) return; - unlink(newpath); + unlink_or_warn(newpath); break; } if (errno != EEXIST) |