commit - cee3836880940ba0d1203e0682a43a680132bc27
commit + 66993e5902f3e39980a0dada0946e146008a35c5
blob - e95ba2936e96e58c1f16c13b3a81b482f35d02a4
blob + a51a450a06ab2800d2fe4a200fc31cc59364dac6
--- 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);