In article <24622.1449946...@splode.eterna.com.au>, matthew green <m...@eterna.com.au> wrote: >"Christos Zoulas" writes: >> Module Name: src >> Committed By: christos >> Date: Sat Dec 12 18:06:58 UTC 2015 >> >> Modified Files: >> src/libexec/httpd: bozohttpd.c bozohttpd.h ssl-bozo.c >> >> Log Message: >> Introduce bozo_strdup and bozo_asprintf to add error checking and reduce >> code duplication. >> >> Note that bozo_strdup is different that bozostrdup; the _ routines exit >> loging error to syslog or stderr, whereas the non _ routines send error >> responses to the http client. > >thanks for the bozo_asprintf() clean ups. those are good. > >the rest of this really doesn't make sense to me. > >the whole point of having bozofunc() is to avoid having to do any >error checking in it. but now there are calls to several of these >that do check errors, and plus the names are too similar. > >there shouldn't really be a distinction. all the calls to strdup() >you adjusted are (newish) bugs that should just have called >bozostrdup(), and there should be no bozo_strdup(). looks like the >vast majority of the strdup() calls were added when i merged >libbozo work, 5.5 years ago, plus a single one from the initial >import.
I think that there are strdup/alloc/ calls that happen before connection time and ones that happen before during configuration and setup. We can either have two functions to handle failure appropriately, or one (which I prefer I think) and that checks the http->logstate or something to see if it should log, or send a response, or both. This requires a bit more surgery... Yes, having two functions with similar names is nasty and silly and I am not planning to keep it. I just wanted to have some discussion first on what to do to solve it. There are 2 or so more strdups that are unchecked in the prefs. Let me know how you prefer to go and I will fix them. christos