about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-08 18:36:56 +0000
committerEric Wong <e@80x24.org>2023-01-08 18:36:56 +0000
commit649a0d3e3578cb385e1a20579c16aca306650b30 (patch)
tree0fd69be88ba56dbbe8ba72121417e6fec1758076
parent22c89c3a4ef6be25758e5d02488ba2d0d186e04f (diff)
downloadmwrap-649a0d3e3578cb385e1a20579c16aca306650b30.tar.gz
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.
-rw-r--r--ext/mwrap/httpd.h8
1 files changed, 8 insertions, 0 deletions
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,