Permalink
Browse files

strtol(3) can optionally set errno to EINVAL if no conversion could be

performed and FreeBSD (at least) implements thin behaviour.  Add an
explicit test to detect this situation in Dispatcher::parse_params().
(This behaviour difference is not relevant to other uses of strtol()).

This corrects the mishandling of (eg) "CSI m" on FreeBSD.
  • Loading branch information...
1 parent d37b1c4 commit 37c86a98793c3615f6356faccafe68394445ae09 @peterjeremy committed Apr 10, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/terminal/terminaldispatcher.cc
@@ -85,7 +85,7 @@ void Dispatcher::parse_params( void )
if ( endptr == segment_begin ) {
val = -1;
}
- if ( errno == 0 ) {
+ if ( errno == 0 || segment_begin == endptr ) {
parsed_params.push_back( val );
}
@@ -99,7 +99,7 @@ void Dispatcher::parse_params( void )
if ( endptr == segment_begin ) {
val = -1;
}
- if ( errno == 0 ) {
+ if ( errno == 0 || segment_begin == endptr ) {
parsed_params.push_back( val );
}

2 comments on commit 37c86a9

wez commented on 37c86a9 Apr 11, 2012

This fixes the weird color bleed I experienced this morning with vim on OSX, and also fixes my regular text color in zsh

wez replied Apr 11, 2012

See also: keithw#110

Please sign in to comment.