mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
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: Kir Kolyshkin <kir@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
9fa2cda2cd
commit
904b6066f6
@@ -201,7 +201,9 @@ int main(int argc, char *argv[])
|
|||||||
COMPEL_SO_VERSION_SUBLEVEL);
|
COMPEL_SO_VERSION_SUBLEVEL);
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
default:
|
default: // '?'
|
||||||
|
// error message already printed by getopt_long()
|
||||||
|
return usage(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user