This leads to error messages like
(null): unrecognized option '--foo'
in case an invalid option was given. Fix it by setting argv[0] to
the receiver name instead.
Thanks to Gerrit Renker for pointing out this bug.
argc = split_args(options, &argv, " \t");
for (i = argc - 1; i >= 0; i--)
argv[i + 1] = argv[i];
- argv[0] = para_strdup(r->name);
argc += 1;
- PARA_DEBUG_LOG("argc = %d, argv[0]: %s\n", argc, argv[0]);
} else {
argc = 1;
argv = para_malloc(2 * sizeof(char*));
- argv[0] = NULL;
argv[1] = NULL;
}
+ argv[0] = make_message("%s_recv", r->name);
conf = r->parse_config(argc, argv);
free(argv[0]);
free(argv);