From "man strtol":
~~~~
Since strtol() can legitimately return 0, LONG_MAX, or LONG_MIN (LLONG_MAX or LLONG_MIN for strtoll()) on both success  and
       failure,  the  calling  program  should set errno to 0 before the call, and then determine if an error occurred by checking
       whether errno has a nonzero value after the call.
~~~~