Resolve Coverity issues

Signed-off-by: John Hood <cgull@glup.org>
This commit is contained in:
John Hood
2015-06-10 04:07:35 -04:00
parent 026a3f0346
commit 6f4a59e20f
3 changed files with 70 additions and 54 deletions
+7 -2
View File
@@ -51,6 +51,7 @@
#include <sys/types.h>
#include <pwd.h>
#include <sys/time.h>
#include <exception>
#if HAVE_PTY_H
#include <pty.h>
@@ -123,7 +124,7 @@ int main( int argc, char *argv[] )
} else {
/* get shell name */
my_argv[ 0 ] = getenv( "SHELL" );
if ( my_argv[ 0 ] == NULL ) {
if ( my_argv[ 0 ] == NULL || *my_argv[ 0 ] == '\0' ) {
struct passwd *pw = getpwuid( geteuid() );
if ( pw == NULL ) {
perror( "getpwuid" );
@@ -151,7 +152,11 @@ int main( int argc, char *argv[] )
exit( 1 );
}
emulate_terminal( master );
try {
emulate_terminal( master );
} catch ( const std::exception &e ) {
fprintf( stderr, "\r\nException caught: %s\r\n", e.what() );
}
if ( tcsetattr( STDIN_FILENO, TCSANOW, &saved_termios ) < 0 ) {
perror( "tcsetattr" );