+static void
+stdio_file_write_async_safe (struct ui_file *file,
+ const char *buf, long length_buf)
+{
+ struct stdio_file *stdio = ui_file_data (file);
+
+ if (stdio->magic != &stdio_file_magic)
+ {
+ /* gettext isn't necessarily async safe, so we can't use _("error message") here.
+ We could extract the correct translation ahead of time, but this is an extremely
+ rare event, and one of the other stdio_file_* routines will presumably catch
+ the problem anyway. For now keep it simple and ignore the error here. */
+ return;
+ }
+
+ /* This is written the way it is to avoid a warning from gcc about not using the
+ result of write (since it can be declared with attribute warn_unused_result).
+ Alas casting to void doesn't work for this. */
+ if (write (stdio->fd, buf, length_buf))
+ ;
+}
+