Welcome! Log In Create A New Profile

Advanced

ngx_snprintf question

Mike Gagnon
April 10, 2012 10:14AM
I am getting unexpected results from ngx_snprintf in the following statement:

ngx_snprintf((u_char *) buf, sizeof(buf), "%s\n",
peer->peer_config->name.data);

with peer->peer_config->name.data == "127.0.0.1:9000\0".

I expect ngx_snprintf to yield buf == "127.0.0.1:9000\n\0", but
instead it yields buf == "127.0.0.1:9000\n\bf\0" (I was not expecting
that '\bf' character to be inserted there.)

When I change ngx_snprintf to just snprintf, it works as expected.

Any thoughts?

Mike Gagnon

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

ngx_snprintf question

Mike Gagnon 1967 April 10, 2012 10:14AM

Re: ngx_snprintf question

Piotr Sikora 642 April 10, 2012 10:56AM

Re: ngx_snprintf question

Mike Gagnon 606 April 10, 2012 11:02AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 307
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready