commit - 5713faaf5800e9e90b79cb24ad3366c54a81db77
commit + 67fdb8a7a3ab501b2155b04b10e69e61779662b9
blob - f47d9defa60c0d149e6367abe262307f7fa4effe
blob + c0a98144883916b626903410a738267157a95ae4
--- got/got.c
+++ got/got.c
if (write(fd, initial_content, initial_content_len) == -1) {
err = got_error_from_errno2("write", *logmsg_path);
+ goto done;
+ }
+ if (close(fd) == -1) {
+ err = got_error_from_errno2("close", *logmsg_path);
goto done;
}
+ fd = -1;
err = edit_logmsg(logmsg, editor, *logmsg_path, initial_content,
initial_content_len, 1);
if (write(fd, initial_content, initial_content_len) == -1) {
err = got_error_from_errno2("write", *tagmsg_path);
+ goto done;
+ }
+ if (close(fd) == -1) {
+ err = got_error_from_errno2("close", *tagmsg_path);
goto done;
}
+ fd = -1;
err = get_editor(&editor);
if (err)
diff_path);
}
+ if (close(fd) == -1) {
+ err = got_error_from_errno2("close", a->logmsg_path);
+ goto done;
+ }
+ fd = -1;
+
err = edit_logmsg(logmsg, a->editor, a->logmsg_path, initial_content,
initial_content_len, a->prepared_log ? 0 : 1);
done:
const struct got_error *err = NULL;
struct got_commit_object *commit = NULL;
int logmsg_len;
- int fd;
+ int fd = -1;
struct got_histedit_list_entry *folded = NULL;
err = got_object_open_as_commit(&commit, repo, hle->commit_id);
if (err)
goto done;
- write(fd, logmsg, logmsg_len);
- close(fd);
+ if (write(fd, logmsg, logmsg_len) == -1) {
+ err = got_error_from_errno2("write", logmsg_path);
+ goto done;
+ }
+ if (close(fd) == -1) {
+ err = got_error_from_errno2("close", logmsg_path);
+ goto done;
+ }
+ fd = -1;
err = get_editor(&editor);
if (err)
err = got_error_from_errno("strdup");
}
done:
+ if (fd != -1 && close(fd) == -1 && err == NULL)
+ err = got_error_from_errno2("close", logmsg_path);
if (logmsg_path && unlink(logmsg_path) != 0 && err == NULL)
err = got_error_from_errno2("unlink", logmsg_path);
free(logmsg_path);