summaryrefslogtreecommitdiffstats
path: root/src/image/script.c
diff options
context:
space:
mode:
authorMichael Brown2007-08-02 02:12:42 +0200
committerMichael Brown2007-08-02 02:12:42 +0200
commit02de18eb3ef5665b74b45ac5e193643735618fb5 (patch)
tree619eeb4919ed443b82020fe94cd17cbc2d987b3a /src/image/script.c
parentAdd code for constructing single-file cpio archives on the fly (diff)
downloadipxe-02de18eb3ef5665b74b45ac5e193643735618fb5.tar.gz
ipxe-02de18eb3ef5665b74b45ac5e193643735618fb5.tar.xz
ipxe-02de18eb3ef5665b74b45ac5e193643735618fb5.zip
Cope with non-newline-terminated scripts.
Print error status using strerror().
Diffstat (limited to 'src/image/script.c')
-rw-r--r--src/image/script.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/image/script.c b/src/image/script.c
index 8e511d21..c8821522 100644
--- a/src/image/script.c
+++ b/src/image/script.c
@@ -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;
}