[lxc-devel] [PATCH 1/8] Fix return type of read/write utility functions.
Serge Hallyn
serge.hallyn at ubuntu.com
Wed Aug 14 19:31:24 UTC 2013
Quoting Christian Seiler (christian at iwakd.de):
> Signed-off-by: Christian Seiler <christian at iwakd.de>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> src/lxc/utils.c | 14 +++++++-------
> src/lxc/utils.h | 6 +++---
> 2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/src/lxc/utils.c b/src/lxc/utils.c
> index c3f734b..89d335d 100644
> --- a/src/lxc/utils.c
> +++ b/src/lxc/utils.c
> @@ -359,9 +359,9 @@ again:
> return status;
> }
>
> -int lxc_write_nointr(int fd, const void* buf, size_t count)
> +ssize_t lxc_write_nointr(int fd, const void* buf, size_t count)
> {
> - int ret;
> + ssize_t ret;
> again:
> ret = write(fd, buf, count);
> if (ret < 0 && errno == EINTR)
> @@ -369,9 +369,9 @@ again:
> return ret;
> }
>
> -int lxc_read_nointr(int fd, void* buf, size_t count)
> +ssize_t lxc_read_nointr(int fd, void* buf, size_t count)
> {
> - int ret;
> + ssize_t ret;
> again:
> ret = read(fd, buf, count);
> if (ret < 0 && errno == EINTR)
> @@ -379,13 +379,13 @@ again:
> return ret;
> }
>
> -int lxc_read_nointr_expect(int fd, void* buf, size_t count, const void* expected_buf)
> +ssize_t lxc_read_nointr_expect(int fd, void* buf, size_t count, const void* expected_buf)
> {
> - int ret;
> + ssize_t ret;
> ret = lxc_read_nointr(fd, buf, count);
> if (ret <= 0)
> return ret;
> - if (ret != count)
> + if ((size_t)ret != count)
> return -1;
> if (expected_buf && memcmp(buf, expected_buf, count) != 0) {
> errno = EINVAL;
> diff --git a/src/lxc/utils.h b/src/lxc/utils.h
> index 14b8439..7473b4d 100644
> --- a/src/lxc/utils.h
> +++ b/src/lxc/utils.h
> @@ -173,9 +173,9 @@ extern int wait_for_pid(pid_t pid);
> extern int lxc_wait_for_pid_status(pid_t pid);
>
> /* send and receive buffers completely */
> -extern int lxc_write_nointr(int fd, const void* buf, size_t count);
> -extern int lxc_read_nointr(int fd, void* buf, size_t count);
> -extern int lxc_read_nointr_expect(int fd, void* buf, size_t count, const void* expected_buf);
> +extern ssize_t lxc_write_nointr(int fd, const void* buf, size_t count);
> +extern ssize_t lxc_read_nointr(int fd, void* buf, size_t count);
> +extern ssize_t lxc_read_nointr_expect(int fd, void* buf, size_t count, const void* expected_buf);
> #if HAVE_LIBGNUTLS
> #define SHA_DIGEST_LENGTH 20
> extern int sha1sum_file(char *fnam, unsigned char *md_value);
> --
> 1.7.10.4
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
More information about the lxc-devel
mailing list