]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Cleanup of large buffer on stack in virFileMakePath
authorLaine Stump <laine@laine.org>
Tue, 26 Jan 2010 13:47:02 +0000 (14:47 +0100)
committerDaniel Veillard <veillard@redhat.com>
Tue, 26 Jan 2010 13:48:21 +0000 (14:48 +0100)
commitba1d379ce82dd079da8d045c434e44f25a7d1916
treeb149cd94c02e3913374405b724a28807032156e0
parent854111f97e0b6d4617f95c628dc754286e2258a2
Cleanup of large buffer on stack in virFileMakePath

virFileMakePath is a recursive function that was creates a buffer
PATH_MAX bytes long for each recursion (one recursion for each element
in the path). This changes it to have no buffers on the stack, and to
allocate just one buffer total, no matter how many elements are in the
path. Because the modified algorithm requires a char* to be passed in
rather than const char *, it is now 2 functions - a toplevel API
function that remains identical in function, and a 2nd helper function
called for the recursions, which 1) doesn't allocate anything, and 2)
takes a char* arg, so it can modify the contents.
* src/util/util.c: rewrite virFileMakePath
src/util/util.c