2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-13 23:01:31 +00:00

Cope with non-newline-terminated scripts.

Print error status using strerror().
This commit is contained in:
Michael Brown 2007-08-02 01:12:42 +01:00
parent 726e366e8f
commit 02de18eb3e

View File

@ -58,6 +58,7 @@ static int script_exec ( struct image *image ) {
len = sizeof ( cmdbuf );
if ( len > remaining )
len = remaining;
memset ( cmdbuf, 0, sizeof ( cmdbuf ) );
copy_from_user ( cmdbuf, image->data, offset, len );
/* Find end of line */
@ -75,8 +76,8 @@ static int script_exec ( struct image *image ) {
*eol = '\0';
DBG ( "$ %s\n", cmdbuf );
if ( ( rc = system ( cmdbuf ) ) != 0 ) {
DBG ( "Command \"%s\" exited with status %d\n",
cmdbuf, rc );
DBG ( "Command \"%s\" failed: %s\n",
cmdbuf, strerror ( rc ) );
goto done;
}