1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-18 20:36:15 +02:00

fast-import: Don't use a maybe-clobbered errno value

Without this change, each diagnostic could use an errno value
clobbered by the close or unlink in rollback_lock_file.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jim Meyering 2008-01-18 19:35:49 +01:00 committed by Junio C Hamano
parent 181256442e
commit 5a7b1b571e

View File

@ -1541,9 +1541,10 @@ static void dump_marks(void)
f = fdopen(mark_fd, "w");
if (!f) {
int saved_errno = errno;
rollback_lock_file(&mark_lock);
failure |= error("Unable to write marks file %s: %s",
mark_file, strerror(errno));
mark_file, strerror(saved_errno));
return;
}
@ -1556,16 +1557,18 @@ static void dump_marks(void)
dump_marks_helper(f, 0, marks);
if (ferror(f) || fclose(f)) {
int saved_errno = errno;
rollback_lock_file(&mark_lock);
failure |= error("Unable to write marks file %s: %s",
mark_file, strerror(errno));
mark_file, strerror(saved_errno));
return;
}
if (commit_lock_file(&mark_lock)) {
int saved_errno = errno;
rollback_lock_file(&mark_lock);
failure |= error("Unable to commit marks file %s: %s",
mark_file, strerror(errno));
mark_file, strerror(saved_errno));
return;
}
}