You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1996/04/22 22:04:59 UTC

Re: WWW Form Bug Report: "mod_status.c assumes sprintf returns the size of the string, but it does not in SunOS4" on SunOS 4.x

thanks for the report. It's now being considered on
the developers mailing list.


>Submitter: jmyers@eecs.nwu.edu
>Operating system: SunOS 4.x, version: 4.1.3
>Version of Apache Used: 1.1b1
>Extra Modules used: mod_status
>URL exhibiting problem: 
>
>Symptoms:
>--
>At least in SunOS4, sprintf returns a pointer
>to the string written instead of the size of
>that string.  mod_status.c assumes that sprintf
>returns the size of the string written.
>
>In orderto fix this for SunOS4 (I don't know 
>what other OSs have sprintf defined this way), 
>the lines using the return status of sprintf 
>need to call strlen() first, to mimick the 
>desired behavior:
>
>    if(days)
>      s+=strlen(sprintf(s," %ld day%s",days,days==1?"":"s"));
>    if(hrs)
>      s+=strlen(sprintf(s," %ld hour%s",hrs,hrs==1?"":"s"));
>    if(mins)
>      s+=strlen(sprintf(s," %ld minute%s",mins,mins==1?"":"s"));
>    if(secs)
>      s+=strlen(sprintf(s," %ld second%s",secs,secs==1?"":"s"));
>    rputs(buf,r);
>
>--
>
>Backtrace:
>--
>
>--

-- 
Rob Hartill (robh@imdb.com)
The Internet Movie Database (IMDb)  http://www.imdb.com/
           ...more movie info than you can poke a stick at.