From 97bf923892a781b71442562510c9ef8492eb1dfe Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 19 Jan 2015 20:28:51 -0800 Subject: [PATCH] Fix minor bugs with printing null bytes * minibuf.c (read_minibuf_noninteractive): * xdisp.c (Ftrace_to_stderr) [GLYPH_DEBUG]: Work even if the Lisp string contains a null byte. --- src/ChangeLog | 5 +++++ src/minibuf.c | 2 +- src/xdisp.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b77f00c21c5..ad7780fbca7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2015-01-20 Paul Eggert + Fix minor bugs with printing null bytes + * minibuf.c (read_minibuf_noninteractive): + * xdisp.c (Ftrace_to_stderr) [GLYPH_DEBUG]: + Work even if the Lisp string contains a null byte. + Port to hypothetical case where Qnil is nonzero * alloc.c (allocate_pseudovector): * callint.c (Fcall_interactively): diff --git a/src/minibuf.c b/src/minibuf.c index 07f489258e1..0d6e2c79813 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -217,7 +217,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, suppress_echo_on_tty (fileno (stdin)); } - fprintf (stdout, "%s", SDATA (prompt)); + fwrite (SDATA (prompt), 1, SBYTES (prompt), stdout); fflush (stdout); val = Qnil; diff --git a/src/xdisp.c b/src/xdisp.c index 8d53274fd7b..9abaeb0d777 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -18815,7 +18815,7 @@ usage: (trace-to-stderr STRING &rest OBJECTS) */) (ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object s = Fformat (nargs, args); - fprintf (stderr, "%s", SDATA (s)); + fwrite (SDATA (s), 1, SBYTES (s), stderr); return Qnil; } -- 2.11.4.GIT