block: get mountpoints from /proc/self/mountinfo
authorDaniel Golle <daniel@makrotopia.org>
Sun, 24 Jul 2016 13:16:16 +0000 (15:16 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 24 Jul 2016 15:25:22 +0000 (17:25 +0200)
Instead of using two different implementations reading /proc/mounts
and /proc/self/mountinfo, gather all information on mountpoints from
/proc/self/mountinfo.
While at it, tokenize mountinfo inline instead of using strtok_r
because it's hard to tell whether strtok_r allocated new memory or
merely returns a pointer to the (last) token. This might later on be
relevant once we want to free that memory...
Tokenizing mountinfo using strchr inline works without allocating any
new memory by scanning and re-writing the string returned by gets().
As a result, the returned string needs to be duplicated to be safe for
use even after the fclose().

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

No differences found