logcat: fix time zone parsing.

There was a missing level of indirection in the test of tzname[0] ---
tzname is a char**, and the indication that your time zone is invalid is
that that's an empty string, not a null pointer.

This caused some incorrect logcat commands to be incorrectly accepted
but with UTC as the time zone.

Additionally, the check for "it can't be UTC or GMT unless you asked for
those explicitly" was wrong in two ways. The logic for the test was
wrong, but *fixing* the logic would be a bug that would prevent anyone
from using (say) Europe/London as a timezone.

Also don't duplicate the $TZ set/reset code.

In passing, remove the unnecessary MIN macro in favor of std::min.

Bug: http://b/186570682
Test: adb shell logcat -d -v Europe/London,threadtime,uid
Test: adb shell logcat -d "'-v threadtime,uid'"
Change-Id: I1309a1639277dc143eb69a88ae256907905a6cac
1 file changed
tree: c1eec71d510cc66ead994ea5b0e5e8ec73a25ffd
  1. liblog/
  2. logcat/
  3. logd/
  4. logwrapper/
  5. rust/
  6. OWNERS
  7. PREUPLOAD.cfg
  8. TEST_MAPPING