Return-Path: owner-postman
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with SMTP id LAA02492 for postgres-redist; Sat, 8 Jul 1995 11:54:40 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199507081854.LAA02492@nobozo.CS.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from sangam.ncst.ernet.in (sangam.ncst.ernet.in [144.16.11.1]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with ESMTP id LAA02482 for <postgres@postgres.berkeley.edu>; Sat, 8 Jul 1995 11:54:30 -0700
Received: from unipune.UUCP (uucp@localhost) by sangam.ncst.ernet.in (8.6.12/8.6.6) with UUCP id AAA05460 for postgres@postgres.berkeley.edu; Sun, 9 Jul 1995 00:24:26 +0530
Received: from unipune.UUCP by iucaa (4.1/SMI-4.1)
	id AA06333; Sat, 8 Jul 95 16:48:10+050
Received: from cs.unipune.ernet.in by unipune.unipune.ernet.in (5.0/SMI-SVR4)
	id AA00370; Sat, 8 Jul 1995 16:07:00 +0500
Received: from asterix.cs.unipune.ernet.in (asterix.cs.unipune.ernet.in [192.9.150.2]) by cs.unipune.ernet.in (8.6.12/8.6.12) with ESMTP id QAA03917 for <postgres@postgres.berkeley.edu>; Sat, 8 Jul 1995 16:38:48 +0500
Received: from localhost (sns@localhost) by asterix.cs.unipune.ernet.in (8.6.12/8.6.12) with SMTP id QAA24137 for <postgres@postgres.berkeley.edu>; Sat, 8 Jul 1995 16:13:08 -2359
Message-Id: <199507301813.QAA24137@asterix.cs.unipune.ernet.in>
X-Authentication-Warning: asterix.cs.unipune.ernet.in: Host localhost didn't use HELO protocol
To: postgres@postgres.Berkeley.EDU
Subject: putenv in postmaster.c
Date: Sat, 08 Jul 1995 16:13:07 -53000
From: Shreeniwas N Sapre <sns@asterix.cs.unipune.ernet.in>
Content-Length: 1096
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Sat, 08 Jul 95 11:54:39 -0700
Resent-XMts: smtp


The use of putenv in postmaster.c (sample below) has crashed
postmaster on our system (DGUX 5.4R2.10). The symptom is its inability
to find "template1" after servicing the first 2 or 3 requests. My
diagnosis is the use of envEntry ( which is on stack) for putenv
causing corrupted environment entries, as putenv keeps a pointer to
the string and not a copy of the string. This problem surfaced after
we made a few changes (unrelated to this problem) to postmaster. We
have made envEntry as "static" as a solution.

Sample Code: 
BackendStartup(packet, port)
...
{
    char		envEntry[4][2 * ARGV_SIZE];
    
......
    sprintf(envEntry[0], "POSTPORT=%d", PostPortName);
    putenv(envEntry[0]);
...... Similar code here.
......
}
------
===========================================================================
Shreeniwas N. Sapre         |E-Mail: sns@cs.unipune.ernet.in
Phone : +91-212-357812(Off) | Snail: Department of Computer Science,
Fax   : +91-212-353899(Off) |        University of Poona, Pune 411007, INDIA
===========================================================================

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/
