mosh-server: Remove unused mosh_read_line function
This function is buggy. feof(file) does not become true until after we’ve tried to read past the last character; it should instead be checking the getc return value for EOF (which is distinct from any unsigned char). Really it should just be replaced by istream &std::getline(istream &is, string &str). Fortunately, it’s unused so we can just delete it. Resolves a truncated stdio return value issue found by Coverity Scan service. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
John Hood
parent
0824e6549a
commit
a52b095f50
@@ -801,19 +801,6 @@ bool device_exists( const char *ut_line )
|
|||||||
return (0 == lstat( device_name.c_str(), &buf ));
|
return (0 == lstat( device_name.c_str(), &buf ));
|
||||||
}
|
}
|
||||||
|
|
||||||
string mosh_read_line( FILE *file )
|
|
||||||
{
|
|
||||||
string ret;
|
|
||||||
while ( !feof( file ) ) {
|
|
||||||
char next = getc( file );
|
|
||||||
if ( next == '\n' ) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
ret.push_back( next );
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void warn_unattached( const string & ignore_entry )
|
void warn_unattached( const string & ignore_entry )
|
||||||
{
|
{
|
||||||
#ifdef HAVE_UTMPX_H
|
#ifdef HAVE_UTMPX_H
|
||||||
|
|||||||
Reference in New Issue
Block a user