Currently ministat doesn't handle such use case:
[freefall ~w/freebsd/usr.bin/ministat (main)] ./ministat iguana - < chameleon ministat: Cannot open -: No error: 0
Also, while porting to OpenBSD it was noted that handling of 'ministat - -' is also broken:
643 for (i = 0; i < nds; i++) { 644 setfilenames[i] = argv[i]; 645 if (!strcmp(argv[i], "-")) 646 setfiles[0] = stdin; 647 else 648 setfiles[i] = fopen(argv[i], "r"); 649 if (setfiles[i] == NULL) 650 err(2, "Cannot open %s", argv[i]); 651 }
on line 645 we check for '-' and if it matches we set setfiles[0] to stdin, in case of 'ministat - -' we don't set new element, and check setfiles[1] for NULL, and fail, on OpenBSD it leads to a crash, since array is un-initialized.
Proposed patch fixes these two cases. Author is Ross L Richardson <openbsd@rlr.id.au>.