]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfsprogs: libxcmd: avoid using strtok()
authorAlex Elder <aelder@sgi.com>
Mon, 3 Oct 2011 12:49:16 +0000 (12:49 +0000)
committerAlex Elder <aelder@sgi.com>
Thu, 6 Oct 2011 20:19:28 +0000 (15:19 -0500)
commit19e786523a98399cc45f52ddee7c988c18b8432f
tree04c054d30e03849c6d26f73ae8640e86b5a32e71
parent044c666320c85cab33025053320b20f6dfbdda41
xfsprogs: libxcmd: avoid using strtok()

The strtok() library routine overwrites delimiting bytes in the
string it is supplied.  It is also not length-constrained.

Since we're making a duplicate of the string anyway, and since we
are only finding the end of a single token, we can do both without
the need to modify the passed-in mount entry structure.

Add checking for memory allocation failures, and if one occurs just
exit (as is the practice elsewhere in this file).

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxcmd/paths.c