From: Paul Eggert Date: Tue, 20 Jan 2015 04:28:51 +0000 (-0800) Subject: Fix minor bugs with printing null bytes X-Git-Tag: emacs-25.0.90~2592^2~15 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=97bf923892a781b71442562510c9ef8492eb1dfe;p=emacs.git 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. --- 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; }