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 LAA02511 for postgres-redist; Sat, 8 Jul 1995 11:56:56 -0700 Resent-From: POSTGRES mailing list Resent-Message-Id: <199507081856.LAA02511@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 LAA02481 for ; 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 AAA05465 for postgres@postgres.berkeley.edu; Sun, 9 Jul 1995 00:24:27 +0530 Received: from unipune.UUCP by iucaa (4.1/SMI-4.1) id AA06395; Sat, 8 Jul 95 16:52:34+050 Received: from cs.unipune.ernet.in by unipune.unipune.ernet.in (5.0/SMI-SVR4) id AA00398; Sat, 8 Jul 1995 16:12:42 +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 ; 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 ; 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 +0000 From: Shreeniwas N Sapre Content-Length: 1096 Resent-To: postgres-redist@postgres.Berkeley.EDU Resent-Date: Sat, 08 Jul 95 11:56:55 -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/