Explorar el Código

Cope with non-newline-terminated scripts.

Print error status using strerror().
tags/v0.9.3
Michael Brown hace 17 años
padre
commit
02de18eb3e
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3
    2
      src/image/script.c

+ 3
- 2
src/image/script.c Ver fichero

@@ -58,6 +58,7 @@ static int script_exec ( struct image *image ) {
58 58
 		len = sizeof ( cmdbuf );
59 59
 		if ( len > remaining )
60 60
 			len = remaining;
61
+		memset ( cmdbuf, 0, sizeof ( cmdbuf ) );
61 62
 		copy_from_user ( cmdbuf, image->data, offset, len );
62 63
 
63 64
 		/* Find end of line */
@@ -75,8 +76,8 @@ static int script_exec ( struct image *image ) {
75 76
 		*eol = '\0';
76 77
 		DBG ( "$ %s\n", cmdbuf );
77 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 81
 			goto done;
81 82
 		}
82 83
 		

Loading…
Cancelar
Guardar