[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state co
From: |
Evan Hanson |
Subject: |
Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption" |
Date: |
Tue, 29 Mar 2016 11:42:47 +1300 |
On 2016-03-27 21:30, Kooda wrote:
> I went for the first solution for now, I suppose it??s a good enough??
> fix for now. A better one should go to CHICKEN 5.
Agreed, though I don't have any idea what that will look like, now. I do
think this one should be applied to both, though, to avoid divergence in
the meantime.
> diff --git a/chicken.h b/chicken.h
> index be5f308..0c985cf 100644
> --- a/chicken.h
> +++ b/chicken.h
> @@ -906,7 +906,7 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret;
> # define C_vfprintf vfprintf
> # define C_fflush fflush
> # define C_getchar getchar
> -# define C_exit exit
> +# define C_exit(x) { C_fflush(NULL); _exit(x); }
I'd prefer to leave C_exit as it is and introduce C__exit instead, or
perhaps put the fflush() call into C_exit_runtime and use that directly
wherever an _exit() is needed. Otherwise, C_exit will be the one C_foo
that isn't just an alias for foo, which seems like asking for trouble.
> diff --git a/posixunix.scm b/posixunix.scm
> index f56960d..ae1b9b0 100644
> --- a/posixunix.scm
> +++ b/posixunix.scm
> @@ -1573,6 +1573,8 @@ EOF
> (define process-fork
> (let ((fork (foreign-lambda int "C_fork")))
> (lambda (#!optional thunk killothers)
> + ;; flush all stdio streams before fork
> + ((foreign-lambda int "fflush" c-pointer) #f)
"C_fflush".
Cheers,
Evan
- [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption", Kooda, 2016/03/19
- Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption", Peter Bex, 2016/03/19
- Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption", Kooda, 2016/03/25
- Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption", John Cowan, 2016/03/25
- Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption", Kooda, 2016/03/26
- Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption", Kooda, 2016/03/26
- Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption", Kooda, 2016/03/27
- Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption",
Evan Hanson <=
- Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption", Kooda, 2016/03/29
- Re: [Chicken-hackers] Fix attempt for bug #1269 "Port or reader state corruption", Evan Hanson, 2016/03/28