logcat: -f <non-existent-directory>/<filename> segfaults

- Check if the result of opendir is NULL in lastLogTime
- Cleanup: alphabetically sorted long options, reserved
  an alias for --regex
- Add a unit test, non existent directory should return
  gracefully with an exit(1) and not SIGSEGV.

NB: This failure was with eng/debug feature logpersist
    turned on, /data/misc/logd/ directory was missing,
    deleted, or temporarily inaccessible.

Bug: 27954627
Change-Id: I60246a53b02fdd7e5490fe458b02ad7b14843584
2 files changed
tree: 16167277767ebc82598e2b5bdca1c628688f0b0f
  1. liblog/
  2. logcat/
  3. logd/
  4. logwrapper/