summaryrefslogtreecommitdiff
path: root/src/bootchart/bootchart.c
diff options
context:
space:
mode:
authorNathaniel Chen <nathaniel.chen@intel.com>2013-03-07 11:09:16 -0800
committerLennart Poettering <lennart@poettering.net>2013-03-07 20:53:14 +0100
commit0ea9530d401827e299c6e04a433e69a7a2a89d80 (patch)
tree8a7ef96d49837a24db4afe3bc481e10d1f88647c /src/bootchart/bootchart.c
parentffbd2c4d45787ba5ba85a32db6551efba66a1ee6 (diff)
bootchart: use _cleanup_close_
use _cleanup_{close_,fclose_} to close streams and file descriptors
Diffstat (limited to 'src/bootchart/bootchart.c')
-rw-r--r--src/bootchart/bootchart.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index 65f16c517c..0ad14dc37d 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 *of = NULL;
+FILE _cleanup_fclose_ *of = NULL;
int overrun = 0;
static int exiting = 0;
-int sysfd=-1;
+int _cleanup_close_ 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;
+ _cleanup_fclose_ FILE *f = NULL;
int gind;
int i, r;
char *init = NULL, *output = NULL;
@@ -378,10 +378,8 @@ 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;