HAMMER Utility - Fix seg-fault in hammer cleanup if blank lines in config
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 14 Dec 2009 16:01:57 +0000 (08:01 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 14 Dec 2009 16:01:57 +0000 (08:01 -0800)
* If the HAMMER config contained blank lines the hammer cleanup
  directive would seg-fault trying to parse it.

* Ignore blank lines.  Also ignore lines beginning with a '#' when
  parsing the config.

Reported-by: elekktretterr@exemail.com.au
sbin/hammer/cmd_cleanup.c

index 6a198f2..e5d9e2d 100644 (file)
@@ -396,6 +396,9 @@ do_cleanup(const char *path)
                cbase = cptr + 1;
 
                cmd = strtok(buf, WS);
+               if (cmd == NULL || cmd[0] == '#')
+                       continue;
+
                arg1 = 0;
                arg2 = 0;
                arg3 = NULL;