On Mon, Nov 18, 2019 at 02:45:19PM +0800, Micky Yun Chan wrote:
> + context = g_option_context_new(NULL);
> + g_option_context_add_main_entries(context, entries, NULL);
> + if (!g_option_context_parse(context, &argc, &argv, &error)) {
> + g_printerr("Option parsing failed: %s\n", error->message);
> + exit(EXIT_FAILURE);
> + }
> + if (opt_print_caps) {
> + g_option_context_get_help(context, true, NULL);
Where did the JSON from the previous patch go?
> + exit(EXIT_SUCCESS);
> + }
> +
> + if (!opt_blk_file) {
> + g_option_context_get_help(context, true, NULL);
Please check the documentation for this function:
https://developer.gnome.org/glib/stable/glib-Commandline-option-parser.html#g-option-context-get-help
It returns a newly allocated string and does not print it.
> + exit(EXIT_FAILURE);
> + }
> +
> + if (opt_socket_path) {
> + lsock = unix_sock_new(opt_socket_path);
> + if (lsock < 0) {
> + exit(EXIT_FAILURE);
> }
> + } else if(opt_fdnum < 0){
> + g_option_context_get_help(context, true, NULL);
Same here.
exit(EXIT_FAILURE) is missing.
signature.asc
Description: PGP signature
