I want to avoid having to use the GNU-extension memmem() when removing the container entry. As mmap() does not guarantee us a \0-terminated string we pwrite() a single terminating \0-byte after the end of the file and the mmap() the file. The terminating \0-byte will then be removed when we ftruncate() the file after we have removed the container entry. This allows us to use standard string-handling functions like strstr(). We wrap strstr() in a while loop to remove duplicate entries.
This patch is unnecessary if using memmem() does not bother anyone but me. (Someone should also please check if my calculations for memmove() and ftruncate() are correct.) Christian Brauner (1): Ensure that mmap()ed memory is \0-terminated (v2) Use pwrite() to write terminating \0-byte src/lxc/lxccontainer.c | 85 ++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 41 deletions(-) -- 2.5.1 _______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel