Skip site navigation (1) Skip section navigation (2)

Re: pg_ctl infinite loop and memory leak

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: pg_ctl infinite loop and memory leak
Date: 2009-09-17 16:55:51
Message-ID: 200909171655.n8HGtq501739@momjian.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Jeff Davis wrote:
> To reproduce:
> 
> 1. initdb -D data
> 2. cat /dev/null > data/postgresql.conf
> 3. pg_ctl -w -D data start
> 
> I attached a quick patch that seems to do the trick. It appears that
> fgets() will always return non-NULL if the size passed in is 1 (i.e.
> maxlength in the caller is 0).
> 
> The patch also changes the same readfile() function in initdb.c. I
> assume it's not a practical problem there, but it should be fixed.
> 
> Thanks to Corry Haines (chaines at truviso dot com) for reporting the
> problem.

I thought I knew the libc API pretty well, but I learned something new
here.  :-)

-- 
  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

In response to

pgsql-bugs by date

Next:From: Paola R.Date: 2009-09-17 17:32:58
Subject: PROBLEMA AL INSTALAR POSTSGRESQL
Previous:From: Andre RotheDate: 2009-09-17 14:44:02
Subject: Re: Wrong default values of columns

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group