mwrap user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] httpd: undefine ruby_snprintf alias for non-Ruby processes
@ 2023-01-08 18:41 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-01-08 18:41 UTC (permalink / raw)
  To: mwrap-public

ruby/subst.h (included by ruby.h) replaces `snprintf' with
`ruby_snprintf'.  This only works in processes linked to Ruby,
but won't work in subprocesses spawned by Ruby.
---
 ext/mwrap/httpd.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ext/mwrap/httpd.h b/ext/mwrap/httpd.h
index 03aef9f..da7ff6d 100644
--- a/ext/mwrap/httpd.h
+++ b/ext/mwrap/httpd.h
@@ -43,6 +43,14 @@
 #define TYPE_CSV "text/csv"
 #define TYPE_PLAIN "text/plain"
 
+/*
+ * C ruby defines snprintf to ruby_snprintf, we can't have that in
+ * non-ruby processes spawned by C ruby
+ */
+#if MWRAP_RUBY && defined(snprintf)
+#	undef snprintf
+#endif
+
 enum mw_qev {
 	MW_QEV_IGNORE = 0,
 	MW_QEV_RD = POLLIN,

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-08 18:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-08 18:41 [PATCH] httpd: undefine ruby_snprintf alias for non-Ruby processes Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mwrap.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).