@@ -259,7 +259,7 @@ static void do_journal_append(char *file) {
259259
260260 memcpy (p , "BOOTCHART=" , 10 );
261261
262- f = open (file , O_RDONLY );
262+ f = open (file , O_RDONLY | O_CLOEXEC );
263263 if (f < 0 ) {
264264 log_error ("Failed to read bootchart data: %m" );
265265 return ;
@@ -356,11 +356,11 @@ int main(int argc, char *argv[]) {
356356 t = time (NULL );
357357 strftime (datestr , sizeof (datestr ), "%Y%m%d-%H%M" , localtime (& t ));
358358 snprintf (output_file , PATH_MAX , "%s/bootchart-%s.svg" , arg_output_path , datestr );
359- of = fopen (output_file , "w " );
359+ of = fopen (output_file , "we " );
360360 }
361361
362362 if (sysfd < 0 )
363- sysfd = open ("/sys" , O_RDONLY );
363+ sysfd = open ("/sys" , O_RDONLY | O_CLOEXEC );
364364
365365 if (!build )
366366 parse_env_file ("/etc/os-release" , NEWLINE ,
@@ -424,7 +424,7 @@ int main(int argc, char *argv[]) {
424424 t = time (NULL );
425425 strftime (datestr , sizeof (datestr ), "%Y%m%d-%H%M" , localtime (& t ));
426426 snprintf (output_file , PATH_MAX , "%s/bootchart-%s.svg" , arg_output_path , datestr );
427- of = fopen (output_file , "w " );
427+ of = fopen (output_file , "we " );
428428 }
429429
430430 if (!of ) {
0 commit comments