2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-22 15:22:11 +00:00

Route perror call through output functions.

This adds `errno_puts` and `errno_printf` output functions that read and
output `errno` value and description in common format and through
common output channels. This also replaces direct uses of `perror` to
use the output functions.

fixes #53
This commit is contained in:
Rene Rivera
2021-10-01 08:51:17 -05:00
parent aaf14325ec
commit a6e6438b48
6 changed files with 47 additions and 9 deletions

View File

@@ -215,7 +215,7 @@ void exec_cmd
/* Create pipes for collecting child output. */
if ( pipe( out ) < 0 || ( globs.pipe_action && pipe( err ) < 0 ) )
{
perror( "pipe" );
errno_puts( "pipe" );
exit( EXITBAD );
}
@@ -257,7 +257,7 @@ void exec_cmd
if ( ( cmdtab[ slot ].pid = vfork() ) == -1 )
{
perror( "vfork" );
errno_puts( "vfork" );
exit( EXITBAD );
}
@@ -294,11 +294,11 @@ void exec_cmd
setrlimit( RLIMIT_CPU, &r_limit );
}
if (0 != setpgid( pid, pid )) {
perror("setpgid(child)");
errno_puts("setpgid(child)");
/* exit( EXITBAD ); */
}
execvp( argv[ 0 ], (char * *)argv );
perror( "execvp" );
errno_puts( "execvp" );
_exit( 127 );
}
@@ -324,7 +324,7 @@ void exec_cmd
cmdtab[ slot ].stream[ OUT ] = fdopen( cmdtab[ slot ].fd[ OUT ], "rb" );
if ( !cmdtab[ slot ].stream[ OUT ] )
{
perror( "fdopen" );
errno_puts( "fdopen" );
exit( EXITBAD );
}
@@ -335,7 +335,7 @@ void exec_cmd
cmdtab[ slot ].stream[ ERR ] = fdopen( cmdtab[ slot ].fd[ ERR ], "rb" );
if ( !cmdtab[ slot ].stream[ ERR ] )
{
perror( "fdopen" );
errno_puts( "fdopen" );
exit( EXITBAD );
}
}