Welcome! Log In Create A New Profile

Advanced

Re: [Patch] add -p option to override prefix

All files from this thread

File Name File Size   Posted by Date  
nginx-prefix.patch 1.9 KB open | download Jérôme Loyet 03/24/2009 Read message
ngx_runtime_config.patch 2 KB open | download Manlio Perillo 03/25/2009 Read message
nginx-prefix-v2.patch 14.4 KB open | download Jérôme Loyet 03/25/2009 Read message
nginx-prefix-full-v2.patch 15.8 KB open | download Jérôme Loyet 03/25/2009 Read message
nginx-prefix-v2.patch 18 KB open | download Jérôme Loyet 03/31/2009 Read message
March 26, 2009 09:02AM
On Thu, Mar 26, 2009 at 01:27:21PM +0100, J?r?me Loyet wrote:

> > the previous patch (nginx-prefix-v2.patch) has to be applied after the
> > first one.
> >
> > I attach here the full patch.
> >
> > ++ jerome
>
> In my path I use ngx_snprintf with "%s%s" but it seems not to work, I
> have overflows using this function.
>
> I add tow logs to check the string content:
> 2009/03/26 11:56:34 [notice] 22943#0: pid file: ./logs/nginx.pid appq
> 2009/03/26 11:56:34 [notice] 22943#0: lock file: ./logs/nginx.lock Y
>
> The function ngx_s(n)printf does not work with "%s%s".
> If I use sprintf instead, it works well. I was sure that ngx_sprintf
> was an alias to sprintf it's but not. Why are those kind of basic
> functions have been recoded ? Is there a reason not to use sprintf ?

ngx_s(n)printf() does not add the trailing zero as nginx does not need
it in general. Therefore instead of

ngx_snprintf(ccf->pid.data, ccf->pid.len, "%s%s",
cycle->root.data, NGX_PREFIX_PID_PATH);

you need

ngx_sprintf(ccf->pid.data, "%V%s%Z",
&cycle->root, NGX_PREFIX_PID_PATH);

As to reasons not to use sprintf(), it has no formats even for
builtin types such as time_t, off_t, pid_t, rlim_t. And I do not want
to convert them to "long long", since on 32-bit platforms %lld format
calls procedures just for division and module, where simple
CPU division/module opcode are enough. Besides, ngx_s(n)printf() supports
some nginx types such as ngx_str_t.


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

[Patch] add -p option to override prefix Attachments

Jérôme Loyet March 24, 2009 11:46AM

Re: [Patch] add -p option to override prefix

Juan Fco. Giordana March 24, 2009 12:27PM

Re: [Patch] add -p option to override prefix

Jérôme Loyet March 24, 2009 01:17PM

Re: [Patch] add -p option to override prefix

Kirill A. Korinskiy March 24, 2009 03:33PM

Re: [Patch] add -p option to override prefix

Jérôme Loyet March 24, 2009 05:59PM

Re: [Patch] add -p option to override prefix

Igor Sysoev March 25, 2009 11:56AM

Re: [Patch] add -p option to override prefix Attachments

Jérôme Loyet March 25, 2009 04:16PM

Re: [Patch] add -p option to override prefix Attachments

Jérôme Loyet March 25, 2009 05:55PM

Re: [Patch] add -p option to override prefix

Jérôme Loyet March 26, 2009 08:27AM

Re: [Patch] add -p option to override prefix

Maxim Dounin March 26, 2009 08:56AM

Re: [Patch] add -p option to override prefix

Igor Sysoev March 26, 2009 09:02AM

Re: [Patch] add -p option to override prefix Attachments

Jérôme Loyet March 31, 2009 04:34PM

Re: [Patch] add -p option to override prefix Attachments

Manlio Perillo March 25, 2009 03:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 233
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