]> git.ipfire.org Git - thirdparty/git.git/commit - notes-merge.c
notes-merge: use O_EXCL to avoid overwriting existing files
authorRené Scharfe <l.s.r@web.de>
Thu, 7 Jul 2016 20:08:30 +0000 (22:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Jul 2016 21:16:26 +0000 (14:16 -0700)
commitdeb9c1575c456b9d12ff05fdd2bec516dfb34ae4
tree5e4176e8274882e8867a465b6c822f214d15f2fa
parent0b65a8dbdb38962e700ee16776a3042beb489060
notes-merge: use O_EXCL to avoid overwriting existing files

Use the open(2) flag O_EXCL to ensure the file doesn't already exist
instead of (racily) calling stat(2) through file_exists().  While at it
switch to xopen() to reduce code duplication and get more consistent
error messages.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
notes-merge.c