diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-02-13 14:59:56 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-02-13 14:59:56 +0100 |
commit | c8a202b7d47f9d6bba3100a208abdadfc383499e (patch) | |
tree | d19560cf0723f8e2305170881eb442b5ecb12b0d /src/bootchart | |
parent | 955d98c9c1104d469c2989dbfb58f58ee6fe9bdc (diff) |
everywhere: always use O_CLOEXEC where it makes sense
Diffstat (limited to 'src/bootchart')
-rw-r--r-- | src/bootchart/bootchart.c | 8 | ||||
-rw-r--r-- | src/bootchart/store.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c index 630f9c5d15..305a31ae94 100644 --- a/src/bootchart/bootchart.c +++ b/src/bootchart/bootchart.c @@ -259,7 +259,7 @@ static void do_journal_append(char *file) { memcpy(p, "BOOTCHART=", 10); - f = open(file, O_RDONLY); + f = open(file, O_RDONLY|O_CLOEXEC); if (f < 0) { log_error("Failed to read bootchart data: %m"); return; @@ -356,11 +356,11 @@ int main(int argc, char *argv[]) { t = time(NULL); strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t)); snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", arg_output_path, datestr); - of = fopen(output_file, "w"); + of = fopen(output_file, "we"); } if (sysfd < 0) - sysfd = open("/sys", O_RDONLY); + sysfd = open("/sys", O_RDONLY|O_CLOEXEC); if (!build) parse_env_file("/etc/os-release", NEWLINE, @@ -424,7 +424,7 @@ int main(int argc, char *argv[]) { t = time(NULL); strftime(datestr, sizeof(datestr), "%Y%m%d-%H%M", localtime(&t)); snprintf(output_file, PATH_MAX, "%s/bootchart-%s.svg", arg_output_path, datestr); - of = fopen(output_file, "w"); + of = fopen(output_file, "we"); } if (!of) { diff --git a/src/bootchart/store.c b/src/bootchart/store.c index 3e0052d212..78c5cf85ec 100644 --- a/src/bootchart/store.c +++ b/src/bootchart/store.c @@ -61,7 +61,7 @@ void log_uptime(void) { char str[32]; double uptime; - f = fopen("/proc/uptime", "r"); + f = fopen("/proc/uptime", "re"); if (!f) return; |