Skip to content

Commit

Permalink
Fix JRUBY-6845 - syslog(3) should be attached as a variadic function
Browse files Browse the repository at this point in the history
  • Loading branch information
vp-of-awesome committed Aug 22, 2012
1 parent ae4fabf commit 0fdf304
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ruby/shared/syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module Foreign
# methods
attach_function :open, "openlog", [:pointer, :int, :int], :void
attach_function :close, "closelog", [], :void
attach_function :write, "syslog", [:int, :string, :string], :void
attach_function :write, "syslog", [:int, :string, :varargs], :void
attach_function :set_mask, "setlogmask", [:int], :int
end

Expand Down Expand Up @@ -208,11 +208,12 @@ def instance
self
end

FORMAT_STRING = '%s'
def write(pri, format, *args)
raise "Syslog must be opened before write" unless @opened

message = format % args
Foreign.write(pri, "%s", message)
Foreign.write(pri, FORMAT_STRING, :string, message, :pointer, nil)
end
private :write
end
Expand Down

0 comments on commit 0fdf304

Please sign in to comment.