Re: Fwd: race in pg_ctl start -w
От | Heikki Linnakangas |
---|---|
Тема | Re: Fwd: race in pg_ctl start -w |
Дата | |
Msg-id | 50805A52.6050009@vmware.com обсуждение исходный текст |
Ответ на | Re: Fwd: race in pg_ctl start -w (Alvaro Herrera <alvherre@2ndquadrant.com>) |
Список | pgsql-bugs |
On 18.10.2012 22:15, Alvaro Herrera wrote: > Dave Vitek wrote: > >> Heikki, >> >> It's happy about the overruns. It did flag an issue where the file >> descriptor can leak when the various early returns get taken. > > This is a common problem with static analysers; they don't realise we > don't care about the leaked resource because the program is shortly > going to terminate anyway. We (used to?) have plenty of false positives > in initdb as reported in the Coverity scanner, for example. Actually, this was a real leak. I should've put close() calls to the cases where the file is empty, or fstat() fails. It doesn't matter when the function is called only once, but in the "pg_ctl start -w" case it's called repeatedly to poll for postmaster startup. Fixed, and I also changed it to not return the last line if it doesn't end in a newline, per Tom's suggestion. - Heikki
В списке pgsql-bugs по дате отправления: