X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fbootchart%2Fbootchart.c;h=9f72d98126c1b4d8e02934b0e6fd0932835ea1ea;hb=bdd13f6be4b588568683a1ab54f421fc6a636dbb;hp=630f9c5d15649d3281d7e59f950b74daa931999d;hpb=955d98c9c1104d469c2989dbfb58f58ee6fe9bdc;p=elogind.git diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c index 630f9c5d1..9f72d9812 100644 --- a/src/bootchart/bootchart.c +++ b/src/bootchart/bootchart.c @@ -220,7 +220,6 @@ static int parse_args(int argc, char *argv[]) { fprintf(stderr, " --help, -h Display this message\n"); fprintf(stderr, "See bootchart.conf for more information.\n"); exit (EXIT_SUCCESS); - break; default: break; } @@ -259,7 +258,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 +355,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 +423,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) {