Welcome! Log In Create A New Profile

Advanced

command line prefix (-p) parameter parsing

August 30, 2012 05:57AM
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
Subject Author Posted

command line prefix (-p) parameter parsing

leki75 August 30, 2012 05:57AM

Re: command line prefix (-p) parameter parsing

leki75 August 30, 2012 06:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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