summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1812564)
raw | patch | inline | side by side (parent: 1812564)
author | Jim Meyering <jim@meyering.net> | |
Fri, 18 Jan 2008 18:35:49 +0000 (19:35 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 18 Jan 2008 21:19:37 +0000 (13:19 -0800) |
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>
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>
fast-import.c | patch | blob | history |
diff --git a/fast-import.c b/fast-import.c
index 5e89eef1aa9884605c600f9b9add32207ec41f43..45b4edf36b04970ccb5589e9abf93d8382c6da9b 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
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;
}
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;
}
}