error handling for log file handle

This commit is contained in:
phanes
2023-02-16 03:49:56 -05:00
parent 79bc82e365
commit 004addd2b4
3 changed files with 21 additions and 1 deletions

View File

@@ -118,6 +118,16 @@ int exec_pty(
FILE * stdout_log_fh = fopen( stdout_log_file.c_str(), "a+" );
FILE * stderr_log_fh = fopen( stderr_log_file.c_str(), "a+" );
if ( stdout_log_fh == NULL ) {
safe_perror( "Error opening STDOUT log file. Aborting.", &ttyOrig );
exit( 1 );
}
if ( stderr_log_fh == NULL ) {
safe_perror( "Error opening STDERR log file. Aborting.", &ttyOrig );
exit( 1 );
}
// create the pipes for the child process to write and read from using its stderr
int fd_child_stderr_pipe[2];