diff options
author | Harald Hoyer <harald@redhat.com> | 2013-02-14 11:26:06 +0100 |
---|---|---|
committer | Auke Kok <auke-jan.h.kok@intel.com> | 2013-02-14 13:49:48 -0800 |
commit | 8846199d2006824debdc587df73826a7efa31d24 (patch) | |
tree | b78b3303787bd67bdbe269526f0ae91f2ab30316 /src | |
parent | 39ccc87c8a70cbe8a02e681cda280baee91b2907 (diff) |
bootchart: if "root=/dev" is not matched, don't try to read /sys
Diffstat (limited to 'src')
-rw-r--r-- | src/bootchart/svg.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c index 414d7af9b9..f8a3776873 100644 --- a/src/bootchart/svg.c +++ b/src/bootchart/svg.c @@ -165,18 +165,19 @@ static void svg_title(const char *build) } /* extract root fs so we can find disk model name in sysfs */ + /* FIXME: this works only in the simple case */ c = strstr(cmdline, "root=/dev/"); if (c) { strncpy(rootbdev, &c[10], 3); rootbdev[3] = '\0'; - } - sprintf(filename, "block/%s/device/model", rootbdev); - fd = openat(sysfd, filename, O_RDONLY); - f = fdopen(fd, "r"); - if (f) { - if (!fgets(model, 255, f)) - fprintf(stderr, "Error reading disk model for %s\n", rootbdev); - fclose(f); + sprintf(filename, "block/%s/device/model", rootbdev); + fd = openat(sysfd, filename, O_RDONLY); + f = fdopen(fd, "r"); + if (f) { + if (!fgets(model, 255, f)) + fprintf(stderr, "Error reading disk model for %s\n", rootbdev); + fclose(f); + } } /* various utsname parameters */ |