title: strtol not behaving as expected, c
body: <pre><code>#include&lt;limits.h&gt;
  #include&lt;errno.h&gt;
  
  long output;
  
  errno = 0;
  output = strtol(input,NULL,10);
  printf("long max = %ld\n",LONG_MAX);
  printf("input = %s\n",input);
  printf("output = %ld\n",output);
  printf("direct call = %ld\n",strtol(input,NULL,10));
  if(errno || output &gt;= INT_MAX || output &lt;= INT_MIN) {
      printf("Input was out of range of int, INT_MIN = %d, INT_MAX = %d\n",INT_MIN,INT_MAX);
      printf("Please input an integer within the allowed range:\n");
  }
  </code></pre>
  
  <p>when the code above is fed with an input array of {'1','2','3','4','5','6','7','8','9','0','1'}</p>
  
  <p>i get an output of:</p>
  
  <pre><code>long max = 9223372036854775807
  input = 12345678901
  output = -539222987
  direct call = 3755744309
  </code></pre>
  
  <p>what is going on... strtol appears to be suffering from overflow but not setting errno</p>