1 diff -urp make-3.81/read.c make-3.81-leak/read.c
2 --- make-3.81/read.c 2006-03-17 15:24:20.000000000 +0100
3 +++ make-3.81-leak/read.c 2008-09-16 16:43:12.000000000 +0200
4 @@ -296,6 +300,37 @@ restore_conditionals (struct conditional
8 +/* If possible, open the file and mark it close-on-exec, so that make
9 + doesn't leak the descriptor to binaries called via $(shell ...).*/
11 +open_makefile (char *filename)
16 + int fd = open (filename, O_RDONLY);
21 + fp = fdopen (fd, "r");
33 + fp = fopen (filename, "r");
40 eval_makefile (char *filename, int flags)
42 @@ -335,7 +376,8 @@ eval_makefile (char *filename, int flags
46 - ebuf.fp = fopen (filename, "r");
47 + ebuf.fp = open_makefile (filename);
49 /* Save the error code so we print the right message later. */
50 makefile_errno = errno;
52 @@ -348,7 +390,7 @@ eval_makefile (char *filename, int flags
53 for (i = 0; include_directories[i] != 0; ++i)
55 included = concat (include_directories[i], "/", filename);
56 - ebuf.fp = fopen (included, "r");
57 + ebuf.fp = open_makefile (included);