iowatcher: Rework --prog to make arg processing safer
authorAndrew Price <anprice@redhat.com>
Sat, 26 Apr 2014 17:22:53 +0000 (18:22 +0100)
committerChris Mason <clm@fb.com>
Wed, 24 Sep 2014 19:02:09 +0000 (12:02 -0700)
commitce225d502b505e189c4c138224a3bc50d0e05be5
tree8bcfbef9d28e041ea697265b1b0d3424f9f16823
parent33e3face4ae0c7e0f67e3a92edc8d1e818ef6515
iowatcher: Rework --prog to make arg processing safer

Previously the --prog option required the program-to-be-run to be
specified as a single string. This meant that shell escaping would be
lost in translation and a sub-shell would be run. Rework --prog to not
take an argument and accept the arguments left after option processing
has ended as the argv for the program-to-be-run.

As we have the program as an argv, run_program2() can now be used to run
it, and now that run_program() is no longer used we can remove it and
remove the '2' from run_program2.

New usage example:

 # iowatcher -p -t foo -d /dev/sda3 sleep 10
 running blktrace blktrace -b 8192 -a queue -a complete -a issue -a notify -D . -d /dev/sda3 -o foo
 running 'sleep' '10'
 sleep exited with 0
 ...

Docs have been updated accordingly.

Signed-off-by: Andrew Price <anprice@redhat.com>
iowatcher/blkparse.c
iowatcher/iowatcher.1
iowatcher/main.c
iowatcher/tracers.c
iowatcher/tracers.h