Detached warning: Omit spurious utmp entries (generated by screen)

This commit is contained in:
Keith Winstein
2013-03-10 16:31:37 -04:00
parent a54e6d1661
commit 093bbc9111
+3 -1
View File
@@ -816,7 +816,9 @@ void warn_unattached( const string & ignore_entry )
&& (username == string( entry->ut_user )) ) { && (username == string( entry->ut_user )) ) {
/* does line show unattached mosh session */ /* does line show unattached mosh session */
string text( entry->ut_host ); string text( entry->ut_host );
if ( (text.substr( 0, 5 ) == "mosh ") if ( (text.size() >= 5)
&& (text.substr( 0, 5 ) == "mosh ")
&& (text[ text.size() - 1 ] == ']')
&& (text != ignore_entry) && (text != ignore_entry)
&& device_exists( entry->ut_line ) ) { && device_exists( entry->ut_line ) ) {
unattached_mosh_servers.push_back( text ); unattached_mosh_servers.push_back( text );