else
s = m;
- fwrite (SDATA (s), SBYTES (s), 1, stderr);
+ /* We want to write this out with a single fwrite call so that
+ output doesn't interleave with other processes writing to
+ stderr at the same time. */
+ {
+ int length = min (INT_MAX, SBYTES (s) + 1);
+ char *string = xmalloc (length);
+
+ memcpy (string, SSDATA (s), length - 1);
+ string[length - 1] = '\n';
+ fwrite (string, 1, length, stderr);
+ xfree (string);
+ }
}
- if (!cursor_in_echo_area)
+ else if (!cursor_in_echo_area)
fputc ('\n', stderr);
+
fflush (stderr);
}