Commit 904b6066 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Andrei Vagin

compel: error out on unknown opt or missing arg

getopt_long() prints an error message and returns '?' in cases
 - an unknown option is given
 - a required option argument is missing

In such cases, we need to show usage and exit with an error.
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 9fa2cda2
......@@ -201,7 +201,9 @@ int main(int argc, char *argv[])
COMPEL_SO_VERSION_SUBLEVEL);
exit(0);
break;
default:
default: // '?'
// error message already printed by getopt_long()
return usage(1);
break;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment