You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 2013/11/16 01:00:28 UTC
Re: svn commit: r1542413 - /httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
When I looked at apr_file_write_full() it appeared that it
could return APR_SUCCESS but not send all the data... I
may be mistaken though. As long as APR_SUCCESS means that
all data was sent, this is perfect.
On Nov 15, 2013, at 4:52 PM, trawick@apache.org wrote:
> Author: trawick
> Date: Fri Nov 15 21:52:58 2013
> New Revision: 1542413
>
> URL: http://svn.apache.org/r1542413
> Log:
> Follow-up to r1540161:
>
> The last arg to apr_file_write_full() isn't needed
> unless you need to know the number of bytes written before
> an error occurred.
>
> Modified:
> httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
>
> Modified: httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c?rev=1542413&r1=1542412&r2=1542413&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c (original)
> +++ httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c Fri Nov 15 21:52:58 2013
> @@ -179,7 +179,6 @@ static void store_slotmem(ap_slotmem_ins
> apr_size_t nbytes;
> const char *storename;
> unsigned char digest[APR_MD5_DIGESTSIZE];
> - apr_size_t written = 0;
>
> storename = slotmem_filename(slotmem->gpool, slotmem->name, 1);
>
> @@ -203,12 +202,12 @@ static void store_slotmem(ap_slotmem_ins
> nbytes = (slotmem->desc.size * slotmem->desc.num) +
> (slotmem->desc.num * sizeof(char)) + AP_UNSIGNEDINT_OFFSET;
> apr_md5(digest, slotmem->persist, nbytes);
> - rv = apr_file_write_full(fp, slotmem->persist, nbytes, &written);
> - if (rv == APR_SUCCESS && written == nbytes) {
> - rv = apr_file_write_full(fp, digest, APR_MD5_DIGESTSIZE, &written);
> + rv = apr_file_write_full(fp, slotmem->persist, nbytes, NULL);
> + if (rv == APR_SUCCESS) {
> + rv = apr_file_write_full(fp, digest, APR_MD5_DIGESTSIZE, NULL);
> }
> apr_file_close(fp);
> - if (rv != APR_SUCCESS || written != APR_MD5_DIGESTSIZE) {
> + if (rv != APR_SUCCESS) {
> apr_file_remove(storename, slotmem->gpool);
> }
> }
>
>
Re: svn commit: r1542413 - /httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
Posted by Jim Jagielski <ji...@jaguNET.com>.
On Nov 15, 2013, at 7:38 PM, Jeff Trawick <tr...@gmail.com> wrote:
> On Nov 15, 2013 7:00 PM, "Jim Jagielski" <ji...@jagunet.com> wrote:
> >
> > When I looked at apr_file_write_full() it appeared that it
> > could return APR_SUCCESS but not send all the data... I
> > may be mistaken though. As long as APR_SUCCESS means that
> > all data was sent, this is perfect.
>
> I don't have it handy, but the APR doc says that written < planned only if an error occurs. Httpd had different uses of written.
Cool. thx.
Re: svn commit: r1542413 - /httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
Posted by Jeff Trawick <tr...@gmail.com>.
On Nov 15, 2013 7:00 PM, "Jim Jagielski" <ji...@jagunet.com> wrote:
>
> When I looked at apr_file_write_full() it appeared that it
> could return APR_SUCCESS but not send all the data... I
> may be mistaken though. As long as APR_SUCCESS means that
> all data was sent, this is perfect.
I don't have it handy, but the APR doc says that written < planned only if
an error occurs. Httpd had different uses of written.
There's still an odd call in mod_lua that needs to be fixed (along with the
surrounding OK/APR_SUCCESS confusion).
>
> On Nov 15, 2013, at 4:52 PM, trawick@apache.org wrote:
>
> > Author: trawick
> > Date: Fri Nov 15 21:52:58 2013
> > New Revision: 1542413
> >
> > URL: http://svn.apache.org/r1542413
> > Log:
> > Follow-up to r1540161:
> >
> > The last arg to apr_file_write_full() isn't needed
> > unless you need to know the number of bytes written before
> > an error occurred.
> >
> > Modified:
> > httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
> >
> > Modified: httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
> > URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c?rev=1542413&r1=1542412&r2=1542413&view=diff
> >
==============================================================================
> > --- httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c (original)
> > +++ httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c Fri Nov 15
21:52:58 2013
> > @@ -179,7 +179,6 @@ static void store_slotmem(ap_slotmem_ins
> > apr_size_t nbytes;
> > const char *storename;
> > unsigned char digest[APR_MD5_DIGESTSIZE];
> > - apr_size_t written = 0;
> >
> > storename = slotmem_filename(slotmem->gpool, slotmem->name, 1);
> >
> > @@ -203,12 +202,12 @@ static void store_slotmem(ap_slotmem_ins
> > nbytes = (slotmem->desc.size * slotmem->desc.num) +
> > (slotmem->desc.num * sizeof(char)) +
AP_UNSIGNEDINT_OFFSET;
> > apr_md5(digest, slotmem->persist, nbytes);
> > - rv = apr_file_write_full(fp, slotmem->persist, nbytes,
&written);
> > - if (rv == APR_SUCCESS && written == nbytes) {
> > - rv = apr_file_write_full(fp, digest, APR_MD5_DIGESTSIZE,
&written);
> > + rv = apr_file_write_full(fp, slotmem->persist, nbytes, NULL);
> > + if (rv == APR_SUCCESS) {
> > + rv = apr_file_write_full(fp, digest, APR_MD5_DIGESTSIZE,
NULL);
> > }
> > apr_file_close(fp);
> > - if (rv != APR_SUCCESS || written != APR_MD5_DIGESTSIZE) {
> > + if (rv != APR_SUCCESS) {
> > apr_file_remove(storename, slotmem->gpool);
> > }
> > }
> >
> >
>