diff options
author | Michael Brown | 2007-08-02 02:12:42 +0200 |
---|---|---|
committer | Michael Brown | 2007-08-02 02:12:42 +0200 |
commit | 02de18eb3ef5665b74b45ac5e193643735618fb5 (patch) | |
tree | 619eeb4919ed443b82020fe94cd17cbc2d987b3a /src/image/script.c | |
parent | Add code for constructing single-file cpio archives on the fly (diff) | |
download | ipxe-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.c | 5 |
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; } |