summaryrefslogtreecommitdiff
path: root/src/bootchart/bootchart.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-07 15:28:03 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-07 15:35:50 -0500
commit1f3523baf7418adf3b2738b3917ef956a8414ab7 (patch)
tree334dde9e12ebf4cfc3ebf219adcb40aee664cf4d /src/bootchart/bootchart.c
parentdb7f1dde30068bd980c78db77867b6956f5295e2 (diff)
Revert "bootchart: use _cleanup_close_"
This reverts commit 0ea9530d401827e299c6e04a433e69a7a2a89d80. attribute(cleanup) can only be used inside functions (*of, sysfd are leaked). Cleanup functions are only called once when exiting scope (*f is leaked twice).
Diffstat (limited to 'src/bootchart/bootchart.c')
-rw-r--r--src/bootchart/bootchart.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index 0ad14dc37d..65f16c517c 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -66,10 +66,10 @@ struct cpu_stat_struct cpustat[MAXCPUS];
int pscount;
int cpus;
double interval;
-FILE _cleanup_fclose_ *of = NULL;
+FILE *of = NULL;
int overrun = 0;
static int exiting = 0;
-int _cleanup_close_ sysfd=-1;
+int sysfd=-1;
/* graph defaults */
bool entropy = false;
@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
char datestr[200];
time_t t = 0;
const char *fn;
- _cleanup_fclose_ FILE *f = NULL;
+ _cleanup_fclose_ FILE *f;
int gind;
int i, r;
char *init = NULL, *output = NULL;
@@ -378,8 +378,10 @@ int main(int argc, char *argv[])
svg_do(build);
fprintf(stderr, "systemd-bootchart wrote %s\n", output_file);
+ fclose(of);
closedir(proc);
+ close(sysfd);
/* nitpic cleanups */
ps = ps_first;