diff --git a/src/shared/elf-util.c b/src/shared/elf-util.c index 79ff4f8116..49492330e2 100644 --- a/src/shared/elf-util.c +++ b/src/shared/elf-util.c @@ -791,7 +791,8 @@ int parse_elf_object(int fd, const char *executable, bool fork_disable_dump, cha NULL); if (r < 0) { if (r == -EPROTO) { /* We should have the errno from the child, but don't clobber original error */ - int e, k; + ssize_t k; + int e; k = read(error_pipe[0], &e, sizeof(e)); if (k < 0 && errno != EAGAIN) /* Pipe is non-blocking, EAGAIN means there's nothing */ diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c index bb0536e48a..4dc0b8f662 100644 --- a/src/shared/journal-importer.c +++ b/src/shared/journal-importer.c @@ -127,7 +127,7 @@ static int fill_fixed_size(JournalImporter *imp, void **data, size_t size) { assert(data); while (imp->filled - imp->offset < size) { - int n; + ssize_t n; if (imp->passive_fd) /* we have to wait for some data to come to us */ diff --git a/src/test/test-copy.c b/src/test/test-copy.c index 7b16cf2258..928afefe71 100644 --- a/src/test/test-copy.c +++ b/src/test/test-copy.c @@ -293,7 +293,7 @@ TEST(copy_tree_at_symlink) { TEST_RET(copy_bytes) { _cleanup_close_pair_ int pipefd[2] = EBADF_PAIR; _cleanup_close_ int infd = -EBADF; - int r, r2; + int r; char buf[1024], buf2[1024]; infd = open("/usr/lib/os-release", O_RDONLY|O_CLOEXEC); @@ -307,14 +307,14 @@ TEST_RET(copy_bytes) { r = copy_bytes(infd, pipefd[1], UINT64_MAX, 0); assert_se(r == 0); - r = read(pipefd[0], buf, sizeof(buf)); - assert_se(r >= 0); + ssize_t n = read(pipefd[0], buf, sizeof(buf)); + assert_se(n >= 0); assert_se(lseek(infd, 0, SEEK_SET) == 0); - r2 = read(infd, buf2, sizeof(buf2)); - assert_se(r == r2); + ssize_t n2 = read(infd, buf2, sizeof(buf2)); + assert_se(n == n2); - assert_se(strneq(buf, buf2, r)); + assert_se(strneq(buf, buf2, n)); /* test copy_bytes with invalid descriptors */ r = copy_bytes(pipefd[0], pipefd[0], 1, 0); diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c index 8f0f6e701c..516bddefbe 100644 --- a/src/test/test-socket-util.c +++ b/src/test/test-socket-util.c @@ -253,9 +253,9 @@ TEST(passfd_read) { assert_se(receive_one_fd_iov(pair[0], &iov, 1, MSG_DONTWAIT, &fd) == 0); assert_se(fd >= 0); - r = read(fd, buf, sizeof(buf)-1); - assert_se(r >= 0); - buf[r] = 0; + ssize_t n = read(fd, buf, sizeof(buf)-1); + assert_se(n >= 0); + buf[n] = 0; ASSERT_STREQ(buf, file_contents); }