| 510 | } |
| 511 | |
| 512 | int xmkstemp_mode(char *filename_template, int mode) |
| 513 | { |
| 514 | int fd; |
| 515 | char origtemplate[PATH_MAX]; |
| 516 | strlcpy(origtemplate, filename_template, sizeof(origtemplate)); |
| 517 | |
| 518 | fd = git_mkstemp_mode(filename_template, mode); |
| 519 | if (fd < 0) { |
| 520 | int saved_errno = errno; |
| 521 | const char *nonrelative_template; |
| 522 | |
| 523 | if (!filename_template[0]) |
| 524 | filename_template = origtemplate; |
| 525 | |
| 526 | nonrelative_template = absolute_path(filename_template); |
| 527 | errno = saved_errno; |
| 528 | die_errno("Unable to create temporary file '%s'", |
| 529 | nonrelative_template); |
| 530 | } |
| 531 | return fd; |
| 532 | } |
| 533 | |
| 534 | /* |
| 535 | * Some platforms return EINTR from fsync. Since fsync is invoked in some |
no test coverage detected