diff options
author | Karel Zak <kzak@redhat.com> | 2010-11-25 23:22:53 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2011-01-03 12:28:46 +0100 |
commit | dd36965211907fd482db8966938334ede5ece089 (patch) | |
tree | d322bf4e93ad4a5dcec704b863c1b7bdf406c9cd /lib | |
parent | b0bb8fb6f9c3d54d230b785695a5bceab7e3f320 (diff) | |
download | util-linux-old-dd36965211907fd482db8966938334ede5ece089.tar.gz |
libmount: use better format for utab, improve bind mounts
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mangle.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/mangle.c b/lib/mangle.c index 938dd8e5..398323a3 100644 --- a/lib/mangle.c +++ b/lib/mangle.c @@ -79,17 +79,20 @@ static inline const char *skip_nonspaces(const char *s) /* * Returns mallocated buffer or NULL in case of error. */ -char *unmangle(const char *s) +char *unmangle(const char *s, const char **end) { char *buf; - const char *end; + const char *e; size_t sz; if (!s) return NULL; - end = skip_nonspaces(s); - sz = end - s + 1; + e = skip_nonspaces(s); + sz = e - s + 1; + + if (end) + *end = e; buf = malloc(sz); if (!buf) @@ -114,7 +117,7 @@ int main(int argc, char *argv[]) printf("mangled: '%s'\n", mangle(argv[2])); else if (!strcmp(argv[1], "--unmangle")) { - char *x = unmangle(argv[2]); + char *x = unmangle(argv[2], NULL); if (x) { printf("unmangled: '%s'\n", x); |