delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/10/16/23:22:56

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
From: Bruce Momjian <pgman AT candle DOT pha DOT pa DOT us>
Message-Id: <200010170321.XAA03987@candle.pha.pa.us>
Subject: Re: [PORTS] Re: Problem Building Cygwin PostgreSQL
In-Reply-To: <20000922155051.A2515@DP> "from Jason Tishler at Sep 22, 2000 03:50:51
pm"
To: Jason Tishler <Jason DOT Tishler AT dothill DOT com>
Date: Mon, 16 Oct 2000 23:21:46 -0400 (EDT)
CC: Earnie Boyd <earnie_boyd AT yahoo DOT com>,
"Dr. Volker Zell" <Dr DOT Volker DOT Zell AT oracle DOT com>,
Cygwin <cygwin AT sources DOT redhat DOT com>, pgsql-ports AT postgresql DOT org
X-Mailer: ELM [version 2.4ME+ PL77 (25)]
MIME-Version: 1.0

Looks like this is fixed in current sources.

> Earnie,
> 
> On Fri, Sep 22, 2000 at 11:01:25AM -0700, Earnie Boyd wrote:
> > Hmm...  This appears that it would potentially cause a memory leak.  What
> > happens if instead of this patch you initialize the pointer to NULL?
> 
> I guess that I should have giving more context:
> 
>     void
>     usage(void)
>     {
>         ...
>         user = getenv("USER");
>         if (!user)
>         {
>     #ifndef WIN32
>             pw = getpwuid(geteuid());
>             if (pw)
>                 user = pw->pw_name;
>             ...
>     #else
>             user = "?";
>     #endif
>         }
>         ...
>     #if !defined(WIN32) && !defined(__CYGWIN__)
>         if (pw)
>             free(pw);
>     #endif
>     }
> 
> The relevant Cygwin source (i.e., src/winsup/cygwin/passwd.cc) and the
> getpwuid() man page (from Solaris):
> 
>     The  functions  getpwnam(),  getpwuid(),   getpwent(),   and
>     fgetpwent() use *static* storage that is re-used in each call,
>     making these routines unsafe for use in multithreaded appli-
>     cations.
> 
> seemed to indicate that free-ing the return value from getpwuid() was a
> bad idea.  Can someone confirm or refute this supposition?
> 
> Thanks,
> Jason
> 
> -- 
> Jason Tishler
> Director, Software Engineering       Phone: +1 (732) 264-8770 x235
> Dot Hill Systems Corporation         Fax:   +1 (732) 264-8798
> 82 Bethany Road, Suite 7             Email: Jason DOT Tishler AT dothill DOT com
> Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman AT candle DOT pha DOT pa DOT us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019