[libvirt] [PATCH 2/2] virnetsockettest: Use a temporary directory in /tmp

Guido Günther agx at sigxcpu.org
Wed Nov 2 22:00:33 UTC 2011


On Wed, Nov 02, 2011 at 03:39:54PM -0600, Eric Blake wrote:
> On 11/02/2011 03:31 PM, Guido Günther wrote:
> >to avoid exceeding UNIX_PATH_MAX
> >---
> >  tests/virnetsockettest.c |   60 ++++++++++++++++++++++++++++++---------------
> >  1 files changed, 40 insertions(+), 20 deletions(-)
> 
> I like this better than Stefan's proposal (a temporary directory is
> better than unlink() on an open fd).
> 
> ACK with one nit:
> 
> >+    char *template;
> >+    char *tmpdir = NULL;
> >+
> >+    template = strdup("/tmp/libvirt_XXXXXX");
> 
> No need to malloc() the template.  Just do:
> 
> char template[] = "/tmp/libvirt_XXXXXX";

This was actually the first version I had but it didn't seem to match
libvirt's style (in the non-const form and I didn't find it in HACKING)
so I went for the explicit strdup. New version attached.
Cheers,
 -- Guido

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-virnetsockettest-Use-a-temporary-directory-in-tmp.patch
Type: text/x-diff
Size: 2791 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111102/55185212/attachment-0001.bin>


More information about the libvir-list mailing list