On Fri, 2013-02-22 at 04:33 -0500, Nathan Scott wrote:
>
> ----- Original Message -----
> > [...] We probably need a hard-coded fail-safe like this
> > for such a pathological case...
> >
> > diff --git a/src/libpcp/src/util.c b/src/libpcp/src/util.c
> > index a92f98c..6f07b13 100644
> > --- a/src/libpcp/src/util.c
> > +++ b/src/libpcp/src/util.c
> > @@ -1091,9 +1091,10 @@ vpmprintf(const char *msg, va_list arg)
> > int fd = -1;
> >
> > #if HAVE_MKSTEMP
> > + char *tmpdir = pmGetConfig("PCP_TMP_DIR");
> > fname = (char *)malloc(MAXPATHLEN+1);
> > if (fname == NULL) goto fail;
> > - snprintf(fname, MAXPATHLEN, "%s/pcp-XXXXXX",
> > pmGetConfig("PCP_TMP_DIR"))
> > + snprintf(fname, MAXPATHLEN, "%s/pcp-XXXXXX", tmpdir ? tmpdir
> > : "/tmp"));
>
> The theory was good, but the patch didn't count on pmGetConfig always
> returning a value (empty string if not found, not NULL).
>
> I've fixed it up & verified the test now passes - will commit shortly.
>
OK we're doubling up here ... I'll compare your patch with my fix ...
I've also changed to pmGetConfig man page so it no longer lies!
|