6493
|
1 --- guile-1.9.15/module/system/base/compile.scm~ 2011-02-15 10:54:38.483090146 +0100 |
|
2 +++ guile-1.9.15/module/system/base/compile.scm 2011-03-03 09:15:24.742333809 +0100 |
|
3 @@ -51,7 +51,7 @@ |
|
4 ;; (put 'call-with-output-file/atomic 'scheme-indent-function 1) |
|
5 (define* (call-with-output-file/atomic filename proc #:optional reference) |
|
6 (let* ((template (string-append filename ".XXXXXX")) |
|
7 - (tmp (mkstemp! template))) |
|
8 + (tmp (mkstemp! template "w+b"))) |
|
9 (call-once |
|
10 (lambda () |
|
11 (with-throw-handler #t |
|
12 --- guile-1.9.15/libguile/posix.h~ 2010-12-14 19:15:17.000000000 +0100 |
|
13 +++ guile-1.9.15/libguile/posix.h 2011-03-03 09:21:46.058955734 +0100 |
|
14 @@ -67,7 +67,7 @@ |
|
15 SCM_API SCM scm_uname (void); |
|
16 SCM_API SCM scm_environ (SCM env); |
|
17 SCM_API SCM scm_tmpnam (void); |
|
18 -SCM_API SCM scm_mkstemp (SCM tmpl); |
|
19 +SCM_API SCM scm_mkstemp (SCM tmpl, SCM mode); |
|
20 SCM_API SCM scm_tmpfile (void); |
|
21 SCM_API SCM scm_open_pipe (SCM pipestr, SCM modes); |
|
22 SCM_API SCM scm_close_pipe (SCM port); |
|
23 --- guile-1.9.15/libguile/posix.c~ 2011-01-29 21:36:58.000000000 +0100 |
|
24 +++ guile-1.9.15/libguile/posix.c 2011-03-03 09:14:46.745199721 +0100 |
|
25 @@ -1329,8 +1329,8 @@ |
|
26 extern int mkstemp (char *); |
|
27 #endif |
|
28 |
|
29 -SCM_DEFINE (scm_mkstemp, "mkstemp!", 1, 0, 0, |
|
30 - (SCM tmpl), |
|
31 +SCM_DEFINE (scm_mkstemp, "mkstemp!", 1, 1, 0, |
|
32 + (SCM tmpl, SCM mode), |
|
33 "Create a new unique file in the file system and return a new\n" |
|
34 "buffered port open for reading and writing to the file.\n" |
|
35 "\n" |
|
36 @@ -1338,6 +1338,8 @@ |
|
37 "created: it must end with @samp{XXXXXX} and those @samp{X}s\n" |
|
38 "will be changed in the string to return the name of the file.\n" |
|
39 "(@code{port-filename} on the port also gives the name.)\n" |
|
40 + "The optional @var{mode}, if given, is a string specifying the\n" |
|
41 + "open mode of the file, e.g. w+b\n" |
|
42 "\n" |
|
43 "POSIX doesn't specify the permissions mode of the file, on GNU\n" |
|
44 "and most systems it's @code{#o600}. An application can use\n" |
|
45 @@ -1354,7 +1356,12 @@ |
|
46 { |
|
47 char *c_tmpl; |
|
48 int rv; |
|
49 - |
|
50 + SCM port; |
|
51 + char *c_mode = "w+"; |
|
52 + |
|
53 + if (!SCM_UNBNDP (mode)) |
|
54 + c_mode = scm_to_locale_string (mode); |
|
55 + |
|
56 scm_dynwind_begin (0); |
|
57 |
|
58 c_tmpl = scm_to_locale_string (tmpl); |
|
59 @@ -1369,7 +1376,10 @@ |
|
60 tmpl, SCM_INUM0); |
|
61 |
|
62 scm_dynwind_end (); |
|
63 - return scm_fdes_to_port (rv, "w+", tmpl); |
|
64 + port = scm_fdes_to_port (rv, c_mode, tmpl); |
|
65 + if (!SCM_UNBNDP (mode)) |
|
66 + free (c_mode); |
|
67 + return port; |
|
68 } |
|
69 #undef FUNC_NAME |
|
70 |