]> Zhao Yanbai Git Server - minix.git/commitdiff
sprofalyze: fix profile data parsing
authorDavid van Moolenbroek <david@minix3.org>
Wed, 27 Feb 2013 17:53:27 +0000 (17:53 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Wed, 27 Feb 2013 17:53:27 +0000 (17:53 +0000)
commands/sprofalyze/sprofalyze.c

index 8a61358b9ef00685c3b9895d7eac50e8aa7edc80..aabef5c8d5be3c098d88f0c9bb5ee2c2bacb6ae5 100755 (executable)
@@ -494,8 +494,9 @@ static void load_trace(const char *path) {
        }
 
        /* check file format and update totals */
-       if (fscanf(file, "stat\n%u %u %u\n",
-               &size_info, &size_sample, &size_proc) != 3) {
+       if (fscanf(file, "stat\n%u %u %u",
+               &size_info, &size_sample, &size_proc) != 3 ||
+               fgetc(file) != '\n') {
                fprintf(stderr, "error: file \"%s\" does not contain an "
                        "sprofile trace\n", path);
                exit(1);