Re: BUG #1337: Problem running PostgreSQL as service, incl.

Lists: pgsql-bugs
From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1337: Problem running PostgreSQL as service, incl. fix
Date: 2004-12-05 09:43:19
Message-ID: 20041205094319.0ECFF73894A@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1337
Logged by: PJMODOS

Email address: pjmodos(at)parba(dot)cz

PostgreSQL version: 8.0 Beta

Operating system: Windows 2000

Description: Problem running PostgreSQL as service, incl. fix

Details:

In 8.0 RC1, because of bug in -D parsing in pg_ctl I am unable to run
postgres as service when I have space in data path - when i register it with
pg_ctl register -D "C:\Program Files\PostgreSQL\data" and try to run it then
it won't work and in event log I have this: pg_ctl: no database directory
specified and environment variable PGDATA unset.

I have found very simple solution, just added + 1 in one of xmallocs and it
seems to work, diff follows:

--- pg_ctl.c Sat Nov 27 19:51:06 2004
+++ pg_ctl_new.c Sun Dec 05 10:21:40 2004
@@ -1289,7 +1289,7 @@
{
case 'D':
{
- char *pgdata_D = xmalloc(strlen(optarg));
+ char *pgdata_D = xmalloc(strlen(optarg) + 1);
char *env_var = xmalloc(strlen(optarg) + 8);

strcpy(pgdata_D, optarg);


From: Neil Conway <neilc(at)samurai(dot)com>
To: PJMODOS <pjmodos(at)parba(dot)cz>
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #1337: Problem running PostgreSQL as service, incl.
Date: 2004-12-06 01:12:04
Message-ID: 1102295524.1494.8.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Sun, 2004-12-05 at 09:43 +0000, PostgreSQL Bugs List wrote:
> In 8.0 RC1, because of bug in -D parsing in pg_ctl I am unable to run
> postgres as service when I have space in data path - when i register it with
> pg_ctl register -D "C:\Program Files\PostgreSQL\data" and try to run it then
> it won't work and in event log I have this: pg_ctl: no database directory
> specified and environment variable PGDATA unset.
>
> I have found very simple solution, just added + 1 in one of xmallocs and it
> seems to work, diff follows:

Thanks, fixed. (I used a slightly different fix: xstrdup() rather than
xmalloc() + strcpy() ).

-Neil