commit - 56b63ca4ab1049de6fa2d6910ce22c16e2b42a53
commit + 08578a35f60be8657db97b705f27a55ab61850c8
blob - 3986b23c81fbc180d2bf37f92161e9fd2855949c
blob + b26da2a0b727f30ffdba6e4970dafa32b3856f53
--- lib/buf.c
+++ lib/buf.c
if (fchmod(fd, mode) < 0)
err = got_error_from_errno2("fchmod", path);
- if (close(fd) != 0 && err == NULL)
+ if (close(fd) == -1 && err == NULL)
err = got_error_from_errno2("close", path);
return err;
(void)unlink(template);
}
- if (close(fd) != 0 && err == NULL)
+ if (close(fd) == -1 && err == NULL)
err = got_error_from_errno("close");
return err;
blob - 134a933494056e53673c29dc390c0621d0fdb1c2
blob + bc5756e623d51979c01828389337089965f782a8
--- lib/fetch.c
+++ lib/fetch.c
GOT_PATH_PROG_FETCH_PACK, tmppackpath);
}
- if (close(imsg_fetchfds[1]) != 0) {
+ if (close(imsg_fetchfds[1]) == -1) {
err = got_error_from_errno("close");
goto done;
}
} else if (idxpid == 0)
got_privsep_exec_child(imsg_idxfds,
GOT_PATH_PROG_INDEX_PACK, tmppackpath);
- if (close(imsg_idxfds[1]) != 0) {
+ if (close(imsg_idxfds[1]) == -1) {
err = got_error_from_errno("close");
goto done;
}
blob - bc4cf864a87ae6ca01a4fa56e150cef5110d17aa
blob + 71a5d735012116d324357ccca04f1c7be867e6c2
--- lib/lockfile.c
+++ lib/lockfile.c
if (lf->path && lf->fd != -1 && unlink(lf->path) != 0)
err = got_error_from_errno("unlink");
- if (lf->fd != -1 && close(lf->fd) != 0 && err == NULL)
+ if (lf->fd != -1 && close(lf->fd) == -1 && err == NULL)
err = got_error_from_errno("close");
free(lf->path);
free(lf->locked_path);
blob - 7fe404aef7be55ad09e966e88a09b5f50694bda7
blob + b85e7651429752168e6f8eff2b764fe8bba2d501
--- lib/object.c
+++ lib/object.c
/* not reached */
}
- if (close(imsg_fds[1]) != 0)
+ if (close(imsg_fds[1]) == -1)
return got_error_from_errno("close");
pack->privsep_child->imsg_fd = imsg_fds[0];
pack->privsep_child->pid = pid;
/* not reached */
}
- if (close(imsg_fds[1]) != 0) {
+ if (close(imsg_fds[1]) == -1) {
err = got_error_from_errno("close");
free(ibuf);
return err;
/* not reached */
}
- if (close(imsg_fds[1]) != 0) {
+ if (close(imsg_fds[1]) == -1) {
err = got_error_from_errno("close");
free(ibuf);
return err;
/* not reached */
}
- if (close(imsg_fds[1]) != 0) {
+ if (close(imsg_fds[1]) == -1) {
err = got_error_from_errno("close");
free(ibuf);
return err;
/* not reached */
}
- if (close(imsg_fds[1]) != 0) {
+ if (close(imsg_fds[1]) == -1) {
err = got_error_from_errno("close");
free(ibuf);
return err;
}
if (outbuf) {
- if (close(outfd) != 0 && err == NULL)
+ if (close(outfd) == -1 && err == NULL)
err = got_error_from_errno("close");
outfd = -1;
(*blob)->f = fmemopen(outbuf, size, "rb");
/* not reached */
}
- if (close(imsg_fds[1]) != 0) {
+ if (close(imsg_fds[1]) == -1) {
err = got_error_from_errno("close");
free(ibuf);
return err;
blob - 69a6e9627e2dc2a7d0090ee468fbae0ab966ad61
blob + 5b8443903a0b59be4df01a675d1d07201d2df656
--- lib/object_create.c
+++ lib/object_create.c
rewind(*blobfile);
done:
free(header);
- if (fd != -1 && close(fd) != 0 && err == NULL)
+ if (fd != -1 && close(fd) == -1 && err == NULL)
err = got_error_from_errno("close");
if (err) {
free(*id);
blob - b46583a6e3ce2fe952e1c30726026d492c7f5734
blob + 712b0f55c1bb511c3d3829528964d5036a503d9d
--- lib/pack.c
+++ lib/pack.c
free(packidx->hdr.large_offsets);
free(packidx->hdr.trailer);
}
- if (close(packidx->fd) != 0 && err == NULL)
+ if (close(packidx->fd) == -1 && err == NULL)
err = got_error_from_errno("close");
free(packidx);
if (err)
return err;
err = got_privsep_wait_for_child(pack->privsep_child->pid);
- if (close(pack->privsep_child->imsg_fd) != 0 && err == NULL)
+ if (close(pack->privsep_child->imsg_fd) == -1 && err == NULL)
err = got_error_from_errno("close");
free(pack->privsep_child);
pack->privsep_child = NULL;
err = got_pack_stop_privsep_child(pack);
if (pack->map && munmap(pack->map, pack->filesize) == -1 && !err)
err = got_error_from_errno("munmap");
- if (pack->fd != -1 && close(pack->fd) != 0 && err == NULL)
+ if (pack->fd != -1 && close(pack->fd) == -1 && err == NULL)
err = got_error_from_errno("close");
pack->fd = -1;
free(pack->path_packfile);
blob - 4fb6f24032dafb92991f1671b8252d6b045fa81b
blob + 2a8fcc8c9e2afd1ce22356056ac095e73d2c28c3
--- lib/privsep.c
+++ lib/privsep.c
void
got_privsep_exec_child(int imsg_fds[2], const char *path, const char *repo_path)
{
- if (close(imsg_fds[0]) != 0) {
+ if (close(imsg_fds[0]) == -1) {
fprintf(stderr, "%s: %s\n", getprogname(), strerror(errno));
_exit(1);
}
blob - 4a6e13fd0afc2e6e9bb7a10467c39500a78a8734
blob + 1118dcefd897d4540eae1a9353d4bec5937e454d
--- lib/repository.c
+++ lib/repository.c
repo->privsep_children[i].pid);
if (child_err && err == NULL)
err = child_err;
- if (close(repo->privsep_children[i].imsg_fd) != 0 &&
+ if (close(repo->privsep_children[i].imsg_fd) == -1 &&
err == NULL)
err = got_error_from_errno("close");
}
blob - 987475721d0a49779239dc049fb56d6ac2e2b2fb
blob + 2d9ccf00b3ed3c679a91587ccfd6c31854daf288
--- lib/worktree.c
+++ lib/worktree.c
free(worktree->base_commit_id);
free(worktree->head_ref_name);
if (worktree->lockfd != -1) {
- if (close(worktree->lockfd) != 0)
+ if (close(worktree->lockfd) == -1)
err = got_error_from_errno2("close",
got_worktree_get_root_path(worktree));
}
if (symlinkf && fclose(symlinkf) == EOF && err == NULL)
err = got_error_from_errno2("fclose", symlink_path);
free(symlink_path);
- if (merged_fd != -1 && close(merged_fd) != 0 && err == NULL)
+ if (merged_fd != -1 && close(merged_fd) == -1 && err == NULL)
err = got_error_from_errno("close");
if (f_orig && fclose(f_orig) == EOF && err == NULL)
err = got_error_from_errno("fclose");
}
done:
- if (fd != -1 && close(fd) != 0 && err == NULL)
+ if (fd != -1 && close(fd) == -1 && err == NULL)
err = got_error_from_errno("close");
if (tmppath != NULL && unlink(tmppath) == -1 && err == NULL)
err = got_error_from_errno2("unlink", tmppath);
}
done:
free_ignores(&arg.ignores);
- if (fd != -1 && close(fd) != 0 && err == NULL)
+ if (fd != -1 && close(fd) == -1 && err == NULL)
err = got_error_from_errno("close");
free(ondisk_path);
return err;
blob - e2a99e9244c1e8aa84a417baa7dee7d96f020631
blob + 092a8f96cc20191276eeb1029676466039e7d80a
--- libexec/got-read-blob/got-read-blob.c
+++ libexec/got-read-blob/got-read-blob.c
if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
} else if (imsg.fd != -1) {
- if (close(imsg.fd) != 0 && err == NULL)
+ if (close(imsg.fd) == -1 && err == NULL)
err = got_error_from_errno("close");
}
if (imsg_outfd.fd != -1) {
- if (close(imsg_outfd.fd) != 0 && err == NULL)
+ if (close(imsg_outfd.fd) == -1 && err == NULL)
err = got_error_from_errno("close");
}
got_privsep_send_error(&ibuf, err);
}
}
- if (close(GOT_IMSG_FD_CHILD) != 0 && err == NULL)
+ if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL)
err = got_error_from_errno("close");
return err ? 1 : 0;
}
blob - c87a051695b4876e48e59e310d957c7230135fb0
blob + 41be1eaa285e55bb1d8159555c63bdfa79adee92
--- libexec/got-read-commit/got-read-commit.c
+++ libexec/got-read-commit/got-read-commit.c
if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
} else if (imsg.fd != -1) {
- if (close(imsg.fd) != 0 && err == NULL)
+ if (close(imsg.fd) == -1 && err == NULL)
err = got_error_from_errno("close");
}
imsg_free(&imsg);
got_privsep_send_error(&ibuf, err);
}
}
- if (close(GOT_IMSG_FD_CHILD) != 0 && err == NULL)
+ if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL)
err = got_error_from_errno("close");
return err ? 1 : 0;
}
blob - b0457c7fd3f8239ee5f52338976899dd8ccaefee
blob + eadef712009b2da9a414361c8395ccbd43f2b1aa
--- libexec/got-read-gitconfig/got-read-gitconfig.c
+++ libexec/got-read-gitconfig/got-read-gitconfig.c
got_privsep_send_error(&ibuf, err);
}
}
- if (close(GOT_IMSG_FD_CHILD) != 0 && err == NULL)
+ if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL)
err = got_error_from_errno("close");
return err ? 1 : 0;
}
blob - 2fe537dc6e1f300194d9d5d74a0b2e170c9a0010
blob + 682d443c685d81724cfda1569e2030e2bb02b87c
--- libexec/got-read-gotconfig/got-read-gotconfig.c
+++ libexec/got-read-gotconfig/got-read-gotconfig.c
got_privsep_send_error(&ibuf, err);
}
}
- if (close(GOT_IMSG_FD_CHILD) != 0 && err == NULL)
+ if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL)
err = got_error_from_errno("close");
return err ? 1 : 0;
}
blob - 5e190138a78d67199c00504c2c04e47659ff322c
blob + 96f238defd60d0d973d36d4b4e6c4a60845cefa6
--- libexec/got-read-object/got-read-object.c
+++ libexec/got-read-object/got-read-object.c
err = got_privsep_send_obj(&ibuf, obj);
done:
- if (close(imsg.fd) != 0 && err == NULL)
+ if (close(imsg.fd) == -1 && err == NULL)
err = got_error_from_errno("close");
imsg_free(&imsg);
if (obj)
got_privsep_send_error(&ibuf, err);
}
}
- if (close(GOT_IMSG_FD_CHILD) != 0 && err == NULL)
+ if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL)
err = got_error_from_errno("close");
return err ? 1 : 0;
}
blob - f753b89137938f9238c2baf1620368646f2ff8c1
blob + dd8568736e94cba3323acae81feb8506fe869f9f
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
break;
}
- if (imsg.fd != -1 && close(imsg.fd) != 0 && err == NULL)
+ if (imsg.fd != -1 && close(imsg.fd) == -1 && err == NULL)
err = got_error_from_errno("close");
imsg_free(&imsg);
if (err)
got_privsep_send_error(&ibuf, err);
}
}
- if (close(GOT_IMSG_FD_CHILD) != 0 && err == NULL)
+ if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL)
err = got_error_from_errno("close");
return err ? 1 : 0;
}
blob - 69d50c0fc848f0a018c842f5226edd670aa1f4c9
blob + 2ee8df0c70c373be7f85f0670e55b5684d877bc2
--- libexec/got-read-tag/got-read-tag.c
+++ libexec/got-read-tag/got-read-tag.c
if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
} else if (imsg.fd != -1) {
- if (close(imsg.fd) != 0 && err == NULL)
+ if (close(imsg.fd) == -1 && err == NULL)
err = got_error_from_errno("close");
}
imsg_free(&imsg);
got_privsep_send_error(&ibuf, err);
}
}
- if (close(GOT_IMSG_FD_CHILD) != 0 && err == NULL)
+ if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL)
err = got_error_from_errno("close");
return err ? 1 : 0;
}
blob - a2f17b2558df8d398aee3beceb01e40e84812c3f
blob + 03b252f3eacb482e43069dd99ef3766fbc09fc74
--- libexec/got-read-tree/got-read-tree.c
+++ libexec/got-read-tree/got-read-tree.c
if (fclose(f) == EOF && err == NULL)
err = got_error_from_errno("fclose");
} else if (imsg.fd != -1) {
- if (close(imsg.fd) != 0 && err == NULL)
+ if (close(imsg.fd) == -1 && err == NULL)
err = got_error_from_errno("close");
}
imsg_free(&imsg);
got_privsep_send_error(&ibuf, err);
}
}
- if (close(GOT_IMSG_FD_CHILD) != 0 && err == NULL)
+ if (close(GOT_IMSG_FD_CHILD) == -1 && err == NULL)
err = got_error_from_errno("close");
return err ? 1 : 0;
}