dmsetup: change the return value when no devices are found
PATCH 1/1 dmsetup: change the return value when no devices are found
Calling 'dmsetup ls --target=multipath' results in this:
root: dmsetup ls --target=multipath
No devices found
root: echo $?
0
Note, 'No devices found' is printed on _stdout_, making it impossible to differentiate if this is an error (as in: dmsetup did not find any devices matching the above criteria) or if this is legit (as in: dmsetup found a device named 'No devices found').
This is absolutely wrong and makes it impossible to use dmsetup in a script.
--- tools/dmsetup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/dmsetup.c +2 -1
@@ -1835,7 +1835,8 @@ static int _process_all(const struct command *cmd, const char *subcommand, int aif (!names->dev) {if (!silent) -printf ("No devices found\n" ); +fprintf (stderr,"No devices found\n" ); + r =0 ; goto out; }
Signature · 1 line
2.1.2