agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Shreeniwas N Sapre <sns@asterix.cs.unipune.ernet.in>
To: postgres@postgres.Berkeley.EDU
Subject: putenv in postmaster.c
Date: Sat, 08 Jul 1995 16:13:07 +0000
Message-ID: <199507301813.QAA24137@asterix.cs.unipune.ernet.in> (raw)


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/



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: sns@asterix.cs.unipune.ernet.in
  Subject: Re: putenv in postmaster.c
  In-Reply-To: <199507301813.QAA24137@asterix.cs.unipune.ernet.in>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox