|
found the reason of the crash
when you do "new_session a" the following code gets executed (under jt_lst_new_session) :
if (optind == argc - 1) {
name = argv[optind ++];
if (strlen(name) >= LST_NAME_SIZE)
{
fprintf(stderr, "Name size is limited to %d\n",
LST_NAME_SIZE - 1);
return -1;
}
This increments optind unnecessarily and never resets it before the call to the next getopt_long() which causes the crash. Looking at the code it appears that this issue is repeated several times in the code. It appears that the assumption is that lst is never executed interactively. When it is executed interactively optind needs to be reset in order for getopt_long() to start scanning from the beginning of the command line.
The same crash can be observed if you do:
new_session a
new_session
|