mirror of
https://github.com/git/git
synced 2024-09-12 21:04:12 +00:00
create_symref: check error return from open().
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
40d6dc0f9d
commit
8a56da2962
4
refs.c
4
refs.c
|
@ -332,6 +332,10 @@ int create_symref(const char *ref_target, const char *refs_heads_master)
|
|||
}
|
||||
lockpath = mkpath("%s.lock", git_HEAD);
|
||||
fd = open(lockpath, O_CREAT | O_EXCL | O_WRONLY, 0666);
|
||||
if (fd < 0) {
|
||||
error("Unable to open %s for writing", lockpath);
|
||||
return -5;
|
||||
}
|
||||
written = write_in_full(fd, ref, len);
|
||||
close(fd);
|
||||
if (written != len) {
|
||||
|
|
Loading…
Reference in a new issue