File microcode-ctl-cloexec.patch of Package microcode_ctl
--- microcode_ctl.c.orig
+++ microcode_ctl.c
@@ -10,6 +10,7 @@
*
*/
+#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -66,7 +67,7 @@ static int do_update(char *device, char
return ENOMEM;
}
- if( (fp=fopen(filename, "r")) == NULL){
+ if( (fp=fopen(filename, "re")) == NULL){
if(print_error_messages)
fprintf(stderr,
"%s: cannot open source file '%s' errno=%d (%s)\n",
@@ -117,7 +118,7 @@ static int do_update(char *device, char
if(print_normal_messages)
fprintf(stderr, "%s: writing microcode (length: %d)\n", progname, length);
- if((outfd = open(device, O_WRONLY)) == -1){
+ if((outfd = open(device, O_WRONLY|O_CLOEXEC)) == -1){
if(print_error_messages)
fprintf(stderr, "%s: cannot open %s for writing errno=%d (%s)\n",
progname, device, errno, strerror(errno));