This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/2] libio: Update tst-fmemopen2.c
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, libc-alpha at sourceware dot org
- Date: Thu, 16 Jul 2015 00:54:15 -0400
- Subject: Re: [PATCH 2/2] libio: Update tst-fmemopen2.c
- Authentication-results: sourceware.org; auth=none
- References: <55802AFD dot 1040404 at linaro dot org> <559C2D12 dot 6000508 at redhat dot com> <559C4341 dot 3040107 at linaro dot org> <55A66422 dot 5010306 at linux dot vnet dot ibm dot com> <55A671BE dot 6090306 at linaro dot org>
> diff --git a/libio/fmemopen.c b/libio/fmemopen.c
> index e6e6a49..3ab3e8d 100644
> --- a/libio/fmemopen.c
> +++ b/libio/fmemopen.c
> @@ -150,7 +150,7 @@ __fmemopen (void *buf, size_t len, const char *mode)
> cookie_io_functions_t iof;
> fmemopen_cookie_t *c;
>
> - c = (fmemopen_cookie_t *) malloc (sizeof (fmemopen_cookie_t));
> + c = (fmemopen_cookie_t *) calloc (sizeof (fmemopen_cookie_t), 1);
> if (c == NULL)
> return NULL;
>
> @@ -165,7 +165,6 @@ __fmemopen (void *buf, size_t len, const char *mode)
> return NULL;
> }
> c->buffer[0] = '\0';
> - c->maxpos = 0;
> }
> else
> {
> @@ -182,7 +181,8 @@ __fmemopen (void *buf, size_t len, const char *mode)
> if (mode[0] == 'w' && mode[1] == '+')
> c->buffer[0] = '\0';
>
> - c->maxpos = strnlen (c->buffer, len);
> + if (mode[0] == 'a')
> + c->maxpos = strnlen (c->buffer, len);
> }
>
>
> Carlos, if you allow I would like to push this modification for 2.22.
Please post a full patch in a new thread with comments about what happened.
I'll ack that new thread.
Cheers,
Carlos.