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>
This commit is contained in:
committed by
Junio C Hamano
parent
fc71db39e0
commit
691f1a28bf
@ -931,7 +931,7 @@ static void unkeep_all_packs(void)
|
||||
struct packed_git *p = all_packs[k];
|
||||
snprintf(name, sizeof(name), "%s/pack/pack-%s.keep",
|
||||
get_object_directory(), sha1_to_hex(p->sha1));
|
||||
unlink(name);
|
||||
unlink_or_warn(name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -981,7 +981,7 @@ static void end_packfile(void)
|
||||
}
|
||||
else {
|
||||
close(old_p->pack_fd);
|
||||
unlink(old_p->pack_name);
|
||||
unlink_or_warn(old_p->pack_name);
|
||||
}
|
||||
free(old_p);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user