chiark / gitweb /
bootchart: remove duplicated code, prevent creating empty files
authorShawn Landden <shawn@churchofgit.com>
Mon, 23 Mar 2015 10:48:41 +0000 (03:48 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 24 Mar 2015 04:12:03 +0000 (00:12 -0400)
In Debian and rawhide Fedora, which have CONFIG_SCHEDSTATS=n,
bootchart creates empty files in /run/log before printing an error.
Stop doing that.

Moreover this duplicated part of the code doesn't even have error checking
so there is no error avoided by doing this early.

Reported-by: tfirg_ on IRC
src/bootchart/bootchart.c

index 99ffb86..71dffc9 100644 (file)
@@ -395,15 +395,6 @@ int main(int argc, char *argv[]) {
                 sampledata->sampletime = gettime_ns();
                 sampledata->counter = samples;
 
-                if (!of && (access(arg_output_path, R_OK|W_OK|X_OK) == 0)) {
-                        t = time(NULL);
-                        r = strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t));
-                        assert_se(r > 0);
-
-                        snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", arg_output_path, datestr);
-                        of = fopen(output_file, "we");
-                }
-
                 if (sysfd < 0)
                         sysfd = open("/sys", O_RDONLY|O_CLOEXEC);