mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 09:04:37 +03:00
Cope with non-newline-terminated scripts.
Print error status using strerror().
This commit is contained in:
@@ -58,6 +58,7 @@ static int script_exec ( struct image *image ) {
|
|||||||
len = sizeof ( cmdbuf );
|
len = sizeof ( cmdbuf );
|
||||||
if ( len > remaining )
|
if ( len > remaining )
|
||||||
len = remaining;
|
len = remaining;
|
||||||
|
memset ( cmdbuf, 0, sizeof ( cmdbuf ) );
|
||||||
copy_from_user ( cmdbuf, image->data, offset, len );
|
copy_from_user ( cmdbuf, image->data, offset, len );
|
||||||
|
|
||||||
/* Find end of line */
|
/* Find end of line */
|
||||||
@@ -75,8 +76,8 @@ static int script_exec ( struct image *image ) {
|
|||||||
*eol = '\0';
|
*eol = '\0';
|
||||||
DBG ( "$ %s\n", cmdbuf );
|
DBG ( "$ %s\n", cmdbuf );
|
||||||
if ( ( rc = system ( cmdbuf ) ) != 0 ) {
|
if ( ( rc = system ( cmdbuf ) ) != 0 ) {
|
||||||
DBG ( "Command \"%s\" exited with status %d\n",
|
DBG ( "Command \"%s\" failed: %s\n",
|
||||||
cmdbuf, rc );
|
cmdbuf, strerror ( rc ) );
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user