Re: [libvirt] [PATCH] fix errors in virReportSystemErrorFull

2009-01-27 Thread Jim Meyering
"Daniel P. Berrange" wrote: > On Tue, Jan 27, 2009 at 11:28:32AM +0100, Jim Meyering wrote: >> "Daniel P. Berrange" wrote: >> ... >> > Looking at the whole method again, I think it needs to be re-written to >> > something closer to this: >> >> Ok, I've adapted that. >> +void virReportSystemErrorF

Re: [libvirt] [PATCH] fix errors in virReportSystemErrorFull

2009-01-27 Thread Daniel P. Berrange
On Tue, Jan 27, 2009 at 11:28:32AM +0100, Jim Meyering wrote: > "Daniel P. Berrange" wrote: > ... > > Looking at the whole method again, I think it needs to be re-written to > > something closer to this: > > Ok, I've adapted that. > +void virReportSystemErrorFull(virConnectPtr conn, > +

Re: [libvirt] [PATCH] fix errors in virReportSystemErrorFull

2009-01-27 Thread Jim Meyering
"Daniel P. Berrange" wrote: ... > Looking at the whole method again, I think it needs to be re-written to > something closer to this: Ok, I've adapted that. Changes: - handle snprintf and vsnprintf failure - insert ": " into the result string - use stpcpy, not strcat (as a general waste-avo

Re: [libvirt] [PATCH] fix errors in virReportSystemErrorFull

2009-01-26 Thread Daniel P. Berrange
On Mon, Jan 26, 2009 at 03:02:48PM +0100, Jim Meyering wrote: > > So, since we'd rather avoid having to allocate at all in the > error-reporting path (esp for OOM errors), I've made it automatic. That doesn't really matter/help the OOM reporting scenario, because the convention for VIR_ERR_NO_MEM

[libvirt] [PATCH] fix errors in virReportSystemErrorFull

2009-01-26 Thread Jim Meyering
While looking at removing most of the remaining uses of strerror, I spotted problems in virReportSystemErrorFull. 1) it would leak "combined" 2) that allocated, written-into buffer wasn't even used So, since we'd rather avoid having to allocate at all in the error-reporting path (esp for OOM e