Command line prefix (-p) parameter parsing

Hi,

I found that giving prefix as command line parameter and the prefix does
not
start with ‘/’ you append a ‘/’ to prefix (version: 1.2.3):

$ /usr/sbin/nginx -p prefix -c nginx.conf
nginx: [emerg] open() “prefix/nginx.conf” failed (2: No such file or
directory)

$ /usr/sbin/nginx -p prefix/ -c nginx.conf
nginx: [emerg] open() “prefix//nginx.conf” failed (2: No such file or
directory)

$ /usr/sbin/nginx -p /prefix -c nginx.conf
nginx: [emerg] open() “/prefixnginx.conf” failed (2: No such file or
directory)

$ /usr/sbin/nginx -p /prefix/ -c nginx.conf
nginx: [emerg] open() “/prefix/nginx.conf” failed (2: No such file or
directory)

I think you wanted to check the last character of prefix and not the
first.
So you should change nginx.c (line 839) from
if (!ngx_path_separator(*p)) {
to
if (len == 0 || !ngx_path_separator(p[len - 1])) {

Regards,
Gabor

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,230320,230320#msg-230320

Oh, I just found that you corrected this in 1.3.x version. Sorry for
this
redundant post.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,230320,230321#msg-230321

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs