Fix parser bug
authorJoel Becker <Joel.Becker@oracle.com>
Wed, 28 Feb 2007 08:38:39 +0000 (09:38 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 28 Feb 2007 08:38:39 +0000 (09:38 +0100)
commit71dc58b8a48edee4b0a749d4723d622ffefde304
tree1de52ee49a56ec5b77c800e5d4d215196bd4ccbe
parentbc5b77a8c46aabea554c4a2c8cca37f27f97969a
Fix parser bug

If the option parser sees a ':', it automatically assumes that
you meant a range.  It will then try to parse the second half of the
option.  This isn't just my external: option, it happens to mem: as
well.  That is:

    1) Option mem=mmaphuge:/dev/shm/foo
    2) handle_option() notices the ':' and stores off ptr2.
    3) __handle_option() corectly sees the option "mem" and maps
       "mmaphuge" to MEM_MMAPHUGE.  It then calls str_mem_cb(), which
       stores off the "/dev/shm/foo" after the ':'.  Still working
       great.
    4) Control returns to handle_option(), which sees that ptr2 is
       non-NULL.  It calls __handle_option() again, pointing to the
       string after the ':'.
    5) __handle_option() prints an error, as "/dev/shm/foo" is not a
       known option.

Fix it by breaking out early for the 2nd parse round if the option
type is a string.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
parse.c