diff options
author | Junio C Hamano <junkio@cox.net> | 2007-01-26 17:00:57 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-01-26 17:00:57 -0800 |
commit | 8a56da29628997289aa8ec888ba85889962393e4 (patch) | |
tree | 2b88eea3eab2fa25c7f7fbda490c6c09031d2fb8 /refs.c | |
parent | vc-git.el: Take into account the destination name in vc-checkout. (diff) | |
download | tgif-8a56da29628997289aa8ec888ba85889962393e4.tar.xz |
create_symref: check error return from open().
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -331,7 +331,11 @@ int create_symref(const char *ref_target, const char *refs_heads_master) return -1; } lockpath = mkpath("%s.lock", git_HEAD); - fd = open(lockpath, O_CREAT | O_EXCL | O_WRONLY, 0666); + 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) { |