commit - a6b21eef0424b9af0a7d5dc6ade675b94dde3150
commit + 56b63ca4ab1049de6fa2d6910ce22c16e2b42a53
blob - 47e8801b98449d0d980a504de018d37c45183fc7
blob + 4cb72ca19c8b859c0474710e93a5154db3170520
--- got/got.c
+++ got/got.c
err = histedit_check_script(histedit_cmds, commits, repo);
done:
- if (f && fclose(f) != 0 && err == NULL)
+ if (f && fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
free(editor);
return err;
rewind(f);
err = histedit_parse_list(histedit_cmds, f, repo);
} else {
- if (fclose(f) != 0) {
+ if (fclose(f) == EOF) {
err = got_error_from_errno("fclose");
goto done;
}
}
}
done:
- if (f && fclose(f) != 0 && err == NULL)
+ if (f && fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
if (path && unlink(path) != 0 && err == NULL)
err = got_error_from_errno2("unlink", path);
}
}
done:
- if (f && fclose(f) != 0 && err == NULL)
+ if (f && fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
free(path);
if (commit)
err = histedit_parse_list(histedit_cmds, f, repo);
done:
- if (f && fclose(f) != 0 && err == NULL)
+ if (f && fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
return err;
}
blob - b657ec5ba42677b92a8726bc24022c48ee71e23e
blob + 5251b5a0c5366a6290eb08871fc51273ed568885
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
if (n == 0 && ferror(f))
error = got_ferror(f, GOT_ERR_IO);
done:
- if (f != NULL && fclose(f) == -1 && error == NULL)
+ if (f != NULL && fclose(f) == EOF && error == NULL)
error = got_error_from_errno("fclose");
free(d_file);
return error;
if (linelen == -1 && ferror(f))
error = got_error_from_errno("getline");
done:
- if (f && fclose(f) == -1 && error == NULL)
+ if (f && fclose(f) == EOF && error == NULL)
error = got_error_from_errno("fclose");
free(line);
free(label1);
if (n == 0 && ferror(f))
error = got_ferror(f, GOT_ERR_IO);
done:
- if (f && fclose(f) == -1 && error == NULL)
+ if (f && fclose(f) == EOF && error == NULL)
error = got_error_from_errno("fclose");
free(d_file);
return NULL;
blob - c8bf3d34301f36a4658b22aaa33062dfaad55853
blob + 8c1e08c465eace7793b3aec1bcd4841063476335
--- lib/blame.c
+++ lib/blame.c
if (munmap(blame->map2, blame->size2) == -1 && err == NULL)
err = got_error_from_errno("munmap");
}
- if (blame->f1 && fclose(blame->f1) != 0 && err == NULL)
+ if (blame->f1 && fclose(blame->f1) == EOF && err == NULL)
err = got_error_from_errno("fclose");
- if (blame->f2 && fclose(blame->f2) != 0 && err == NULL)
+ if (blame->f2 && fclose(blame->f2) == EOF && err == NULL)
err = got_error_from_errno("fclose");
free(blame->lines);
free(blame->line_offsets1);
blob - 194fedc8fa1abc94fee0ebebe9c8a693426b89c2
blob + d26165918de1c2cf191ee734e77336fd67356f58
--- lib/delta.c
+++ lib/delta.c
err = got_error(GOT_ERR_BAD_DELTA);
if (memstream != NULL) {
- if (fclose(memstream) != 0)
+ if (fclose(memstream) == EOF)
err = got_error_from_errno("fclose");
if (err == NULL) {
size_t n;
blob - ab9338f610ccb3d2aac14b126d7201e501f48cb3
blob + 54a0944d64ec3e964a3e3d8938d5cea99aaf76f6
--- lib/diff.c
+++ lib/diff.c
err = free_err;
}
done:
- if (f1 && fclose(f1) != 0 && err == NULL)
+ if (f1 && fclose(f1) == EOF && err == NULL)
err = got_error_from_errno("fclose");
- if (f2 && fclose(f2) != 0 && err == NULL)
+ if (f2 && fclose(f2) == EOF && err == NULL)
err = got_error_from_errno("fclose");
return err;
}
err = free_err;
}
done:
- if (f1 && fclose(f1) != 0 && err == NULL)
+ if (f1 && fclose(f1) == EOF && err == NULL)
err = got_error_from_errno("fclose");
return err;
}
blob - 861cb6f29586892ef12113a5db50c7e4329eb9e0
blob + 837a0e0977d8c7fbd52ad7789978b0e57d7b1ebb
--- lib/diff3.c
+++ lib/diff3.c
err = got_error_from_errno2("unlink", outpath);
free(outpath);
}
- if (outfile && fclose(outfile) != 0 && err == NULL)
+ if (outfile && fclose(outfile) == EOF && err == NULL)
err = got_error_from_errno("fclose");
- if (f1 && fclose(f1) != 0 && err == NULL)
+ if (f1 && fclose(f1) == EOF && err == NULL)
err = got_error_from_errno("fclose");
- if (f2 && fclose(f2) != 0 && err == NULL)
+ if (f2 && fclose(f2) == EOF && err == NULL)
err = got_error_from_errno("fclose");
return err;
}
free(patch);
for (i = 0; i < nitems(d3s->fp); i++) {
- if (d3s->fp[i] && fclose(d3s->fp[i]) != 0 && err == NULL)
+ if (d3s->fp[i] && fclose(d3s->fp[i]) == EOF && err == NULL)
err = got_error_from_errno("fclose");
}
if (err == NULL && diffb) {
(*dd)[i].new.from = (*dd)[i - 1].new.to;
}
done:
- if (fclose(f) != 0 && err == NULL)
+ if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
if (err == NULL)
*n = i;
blob - 918b50bbce65306ade20a6e42612dd9e4ad88aac
blob + 7bfd862b598c07fd5e72ed48db149670ae49ffbb
--- lib/diffreg.c
+++ lib/diffreg.c
err = got_error_from_errno("munmap");
if (p2 && munmap(p2, size2) == -1 && err == NULL)
err = got_error_from_errno("munmap");
- if (f1 && fclose(f1) != 0 && err == NULL)
+ if (f1 && fclose(f1) == EOF && err == NULL)
err = got_error_from_errno("fclose");
- if (f2 && fclose(f2) != 0 && err == NULL)
+ if (f2 && fclose(f2) == EOF && err == NULL)
err = got_error_from_errno("fclose");
return err;
}
blob - 7bd55922b5b83ac06fbadac4c69364802b1a6179
blob + 7fe404aef7be55ad09e966e88a09b5f50694bda7
--- lib/object.c
+++ lib/object.c
{
const struct got_error *err = NULL;
free(blob->read_buf);
- if (blob->f && fclose(blob->f) != 0)
+ if (blob->f && fclose(blob->f) == EOF)
err = got_error_from_errno("fclose");
free(blob->data);
free(blob);
blob - 71e76e0ebe9a73692b22f11470e926c20f44b98c
blob + 69a6e9627e2dc2a7d0090ee468fbae0ab966ad61
--- lib/object_create.c
+++ lib/object_create.c
err = got_error_from_errno2("unlink", tmppath);
free(tmppath);
}
- if (tmpfile && fclose(tmpfile) != 0 && err == NULL)
+ if (tmpfile && fclose(tmpfile) == EOF && err == NULL)
err = got_error_from_errno("fclose");
if (lf)
unlock_err = got_lockfile_unlock(lf);
done:
free(header);
free(sorted_entries);
- if (treefile && fclose(treefile) != 0 && err == NULL)
+ if (treefile && fclose(treefile) == EOF && err == NULL)
err = got_error_from_errno("fclose");
if (err) {
free(*id);
free(tree_str);
free(author_str);
free(committer_str);
- if (commitfile && fclose(commitfile) != 0 && err == NULL)
+ if (commitfile && fclose(commitfile) == EOF && err == NULL)
err = got_error_from_errno("fclose");
if (err) {
free(*id);
free(header);
free(obj_str);
free(tagger_str);
- if (tagfile && fclose(tagfile) != 0 && err == NULL)
+ if (tagfile && fclose(tagfile) == EOF && err == NULL)
err = got_error_from_errno("fclose");
if (err) {
free(*id);
blob - 29ca0f7c0d9a9deade9e459946d5f1eaca46a77b
blob + 71840ebb38db39cca7f0629d64ca474b0077e335
--- lib/reference.c
+++ lib/reference.c
}
done:
free(line);
- if (fclose(f) != 0 && err == NULL) {
+ if (fclose(f) == EOF && err == NULL) {
err = got_error_from_errno("fclose");
if (*ref) {
if (lock)
err = open_packed_ref(ref, f, subdirs, nitems(subdirs),
refname);
if (!err) {
- if (fclose(f) != 0) {
+ if (fclose(f) == EOF) {
err = got_error_from_errno("fclose");
got_ref_close(*ref);
*ref = NULL;
free(buf);
free(line);
free(path_refs);
- if (f && fclose(f) != 0 && err == NULL)
+ if (f && fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
return err;
}
if (ref->lf == NULL && lf)
unlock_err = got_lockfile_unlock(lf);
if (f) {
- if (fclose(f) != 0 && err == NULL)
+ if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
}
free(path_refs);
if (delref->lf == NULL && lf)
unlock_err = got_lockfile_unlock(lf);
if (f) {
- if (fclose(f) != 0 && err == NULL)
+ if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
}
if (tmpf) {
unlink(tmppath);
- if (fclose(tmpf) != 0 && err == NULL)
+ if (fclose(tmpf) == EOF && err == NULL)
err = got_error_from_errno("fclose");
}
free(tmppath);
blob - 9eb2d798442973db6cdaca5e079d37834bf0ca46
blob + 987475721d0a49779239dc049fb56d6ac2e2b2fb
--- lib/worktree.c
+++ lib/worktree.c
}
done:
- if (fclose(tmpfile) != 0 && err == NULL)
+ if (fclose(tmpfile) == EOF && err == NULL)
err = got_error_from_errno2("fclose", tmppath);
free(tmppath);
return err;
err = check_file_contents_equal(same, f1, f2);
done:
- if (f1 && fclose(f1) != 0 && err == NULL)
+ if (f1 && fclose(f1) == EOF && err == NULL)
err = got_error_from_errno("fclose");
- if (f2 && fclose(f2) != 0 && err == NULL)
+ if (f2 && fclose(f2) == EOF && err == NULL)
err = got_error_from_errno("fclose");
return err;
free(symlink_path);
if (merged_fd != -1 && close(merged_fd) != 0 && err == NULL)
err = got_error_from_errno("close");
- if (f_orig && fclose(f_orig) != 0 && err == NULL)
+ if (f_orig && fclose(f_orig) == EOF && err == NULL)
err = got_error_from_errno("fclose");
free(merged_path);
free(base_path);
ondisk_path, path, st_mode, blob_deriv_path, label_orig,
label_deriv, repo, progress_cb, progress_arg);
done:
- if (f_deriv && fclose(f_deriv) != 0 && err == NULL)
+ if (f_deriv && fclose(f_deriv) == EOF && err == NULL)
err = got_error_from_errno("fclose");
free(base_path);
if (blob_deriv_path) {
err = got_error_from_errno2("fopen", *fileindex_path);
} else {
err = got_fileindex_read(*fileindex, index);
- if (fclose(index) != 0 && err == NULL)
+ if (fclose(index) == EOF && err == NULL)
err = got_error_from_errno("fclose");
}
done:
if (path_new_staged_content &&
unlink(path_new_staged_content) == -1 && err == NULL)
err = got_error_from_errno2("unlink", path_new_staged_content);
- if (f && fclose(f) != 0 && err == NULL)
+ if (f && fclose(f) == EOF && err == NULL)
err = got_error_from_errno2("fclose", path_unstaged_content);
free(path_unstaged_content);
free(path_new_staged_content);
blob - 7e406576e1b1c9b3b3f5259a819620d83680b7f7
blob + e2a99e9244c1e8aa84a417baa7dee7d96f020631
--- libexec/got-read-blob/got-read-blob.c
+++ libexec/got-read-blob/got-read-blob.c
done:
free(buf);
if (f) {
- if (fclose(f) != 0 && err == NULL)
+ if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
} else if (imsg.fd != -1) {
if (close(imsg.fd) != 0 && err == NULL)
blob - 02685f91e98ddcfe9403eec99e73b35f964a30fb
blob + c87a051695b4876e48e59e310d957c7230135fb0
--- libexec/got-read-commit/got-read-commit.c
+++ libexec/got-read-commit/got-read-commit.c
got_object_commit_close(commit);
done:
if (f) {
- if (fclose(f) != 0 && err == NULL)
+ if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
} else if (imsg.fd != -1) {
if (close(imsg.fd) != 0 && err == NULL)
blob - 27d10ab755d53e96136938c0a9d1d5a574974686
blob + f753b89137938f9238c2baf1620368646f2ff8c1
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
err = got_privsep_send_blob(ibuf, obj->size, obj->hdrlen, buf);
done:
free(buf);
- if (outfile && fclose(outfile) != 0 && err == NULL)
+ if (outfile && fclose(outfile) == EOF && err == NULL)
err = got_error_from_errno("fclose");
- if (basefile && fclose(basefile) != 0 && err == NULL)
+ if (basefile && fclose(basefile) == EOF && err == NULL)
err = got_error_from_errno("fclose");
- if (accumfile && fclose(accumfile) != 0 && err == NULL)
+ if (accumfile && fclose(accumfile) == EOF && err == NULL)
err = got_error_from_errno("fclose");
got_object_close(obj);
if (err && err->code != GOT_ERR_PRIVSEP_PIPE)
blob - aad8331a9697582ede82b7f52785bf4c8b173cb8
blob + 69d50c0fc848f0a018c842f5226edd670aa1f4c9
--- libexec/got-read-tag/got-read-tag.c
+++ libexec/got-read-tag/got-read-tag.c
err = got_privsep_send_tag(&ibuf, tag);
done:
if (f) {
- if (fclose(f) != 0 && err == NULL)
+ if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
} else if (imsg.fd != -1) {
if (close(imsg.fd) != 0 && err == NULL)
blob - 741d51f94fe1970f533774c6866a6f49965e182f
blob + a2f17b2558df8d398aee3beceb01e40e84812c3f
--- libexec/got-read-tree/got-read-tree.c
+++ libexec/got-read-tree/got-read-tree.c
got_object_parsed_tree_entries_free(&entries);
free(buf);
if (f) {
- if (fclose(f) != 0 && err == NULL)
+ if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
} else if (imsg.fd != -1) {
if (close(imsg.fd) != 0 && err == NULL)
blob - 5a34b467d53cdd00972ddb50999b123d4ff69ac9
blob + 984dc73376528f545472d7e802bb1dc495fb001d
--- regress/delta/delta_test.c
+++ regress/delta/delta_test.c
err = got_delta_apply(base_file, dt->delta, dt->delta_len,
result_file, &result_len);
- if (fclose(base_file) != 0 && err == NULL)
+ if (fclose(base_file) == EOF && err == NULL)
err = got_error_from_errno("fclose");
if (dt->expected == NULL) {
/* Invalid delta, expect an error. */
blob - 767893aa64eee3688b73721fe03b7b54ae2f99a8
blob + 915bc83532c216505a96c19f3ac75ac031f66b87
--- tog/tog.c
+++ tog/tog.c
err = got_error_from_errno("got_opentemp");
goto done;
}
- if (s->f && fclose(s->f) != 0) {
+ if (s->f && fclose(s->f) == EOF) {
err = got_error_from_errno("fclose");
goto done;
}
blame->thread_args.repo = NULL;
}
if (blame->f) {
- if (fclose(blame->f) != 0 && err == NULL)
+ if (fclose(blame->f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
blame->f = NULL;
}