Skip to content

Commit

Permalink
create_symref: check error return from open().
Browse files Browse the repository at this point in the history
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Jan 27, 2007
1 parent 40d6dc0 commit 8a56da2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8a56da2

Please sign in to comment.