]> git.ipfire.org Git - thirdparty/git.git/blame - compat/open.c
Merge branch 'vm/t7301-use-test-path-helpers'
[thirdparty/git.git] / compat / open.c
CommitLineData
2b081012
JK
1#include "git-compat-util.h"
2
3#undef open
4int git_open_with_retry(const char *path, int flags, ...)
5{
6 mode_t mode = 0;
7 int ret;
8
9 /*
10 * Also O_TMPFILE would take a mode, but it isn't defined everywhere.
11 * And anyway, we don't use it in our code base.
12 */
13 if (flags & O_CREAT) {
14 va_list ap;
15 va_start(ap, flags);
16 mode = va_arg(ap, int);
17 va_end(ap);
18 }
19
20 do {
21 ret = open(path, flags, mode);
22 } while (ret < 0 && errno == EINTR);
23
24 return ret;
25}