MCPcopy Index your code
hub / github.com/git/git / xfopen

Function xfopen

wrapper.c:357–373  ·  view source on GitHub ↗

* xfopen() is the same as fopen(), but it die()s if the fopen() fails. */

Source from the content-addressed store, hash-verified

355 * xfopen() is the same as fopen(), but it die()s if the fopen() fails.
356 */
357FILE *xfopen(const char *path, const char *mode)
358{
359 for (;;) {
360 FILE *fp = fopen(path, mode);
361 if (fp)
362 return fp;
363 if (errno == EINTR)
364 continue;
365
366 if (*mode && mode[1] == '+')
367 die_errno(_("could not open '%s' for reading and writing"), path);
368 else if (*mode == 'w' || *mode == 'a')
369 die_errno(_("could not open '%s' for writing"), path);
370 else
371 die_errno(_("could not open '%s' for reading"), path);
372 }
373}
374
375FILE *xfdopen(int fd, const char *mode)
376{

Callers 15

parse_pathspec_fileFunction · 0.85
read_refs_snapshotFunction · 0.85
GIT_PATH_FUNCFunction · 0.85
write_promisor_fileFunction · 0.85
diff_opt_outputFunction · 0.85
cmd__crontabFunction · 0.85
generate_fast_packFunction · 0.85
copy_notes_for_rebaseFunction · 0.85
detect_patch_formatFunction · 0.85
parse_mailFunction · 0.85
get_mail_commit_oidFunction · 0.85

Calls 1

die_errnoFunction · 0.85

Tested by 4

parse_pathspec_fileFunction · 0.68
cmd__crontabFunction · 0.68
generate_fast_packFunction · 0.68