Browse code

fix loading from .cvd.

Chomp first line too, and look for \0 instead of \n.

Török Edvin authored on 2010/02/02 20:46:37
Showing 1 changed files
... ...
@@ -470,7 +470,7 @@ static int parseHeader(struct cli_bc *bc, unsigned char *buffer, unsigned *linel
470 470
     }
471 471
     offset++;
472 472
     *linelength = strtol(buffer+offset, &pos, 10);
473
-    if (*pos != '\n') {
473
+    if (*pos != '\0') {
474 474
 	cli_errmsg("Invalid number: %s\n", buffer+offset);
475 475
 	return CL_EMALFDB;
476 476
     }
... ...
@@ -1241,6 +1241,7 @@ int cli_bytecode_load(struct cli_bc *bc, FILE *f, struct cli_dbio *dbio, int tru
1241 1241
 	cli_errmsg("Unable to load bytecode (empty file)\n");
1242 1242
 	return CL_EMALFDB;
1243 1243
     }
1244
+    cli_chomp(firstbuf);
1244 1245
     rc = parseHeader(bc, (unsigned char*)firstbuf, &linelength);
1245 1246
     if (rc == CL_BREAK) {
1246 1247
 	bc->state = bc_skip;