Browse Source

Cope with non-newline-terminated scripts.

Print error status using strerror().
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
02de18eb3e
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      src/image/script.c

+ 3
- 2
src/image/script.c View File

58
 		len = sizeof ( cmdbuf );
58
 		len = sizeof ( cmdbuf );
59
 		if ( len > remaining )
59
 		if ( len > remaining )
60
 			len = remaining;
60
 			len = remaining;
61
+		memset ( cmdbuf, 0, sizeof ( cmdbuf ) );
61
 		copy_from_user ( cmdbuf, image->data, offset, len );
62
 		copy_from_user ( cmdbuf, image->data, offset, len );
62
 
63
 
63
 		/* Find end of line */
64
 		/* Find end of line */
75
 		*eol = '\0';
76
 		*eol = '\0';
76
 		DBG ( "$ %s\n", cmdbuf );
77
 		DBG ( "$ %s\n", cmdbuf );
77
 		if ( ( rc = system ( cmdbuf ) ) != 0 ) {
78
 		if ( ( rc = system ( cmdbuf ) ) != 0 ) {
78
-			DBG ( "Command \"%s\" exited with status %d\n",
79
-			      cmdbuf, rc );
79
+			DBG ( "Command \"%s\" failed: %s\n",
80
+			      cmdbuf, strerror ( rc ) );
80
 			goto done;
81
 			goto done;
81
 		}
82
 		}
82
 		
83
 		

Loading…
Cancel
Save