~sircmpwn/ctools

d6ae9f8a356d6617aba7f47d6246a74929fc12b7 — Simon Ser 2 years ago a3e3f27
cksum: add error handling for open
1 files changed, 4 insertions(+), 0 deletions(-)

M src/cksum.c
M src/cksum.c => src/cksum.c +4 -0
@@ 95,6 95,10 @@ main(int argc, char *argv[])
	} else {
		for (int i = 1; i < argc; ++i) {
			int fd = open(argv[i], O_RDONLY);
			if (fd < 0) {
				perror(argv[i]);
				return 1;
			}
			if (cksum(fd, argv[i]) != 0) {
				close(fd);
				return 1;