Return-Path: owner-postman
Received: from localhost (localhost [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id SAA16752 for postgres-redist; Tue, 21 Jun 1994 18:35:43 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199406220135.SAA16752@nobozo.CS.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from faerie.CS.Berkeley.EDU (faerie.CS.Berkeley.EDU [128.32.149.14]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with ESMTP id SAA16742 for <postgres@postgres.Berkeley.EDU>; Tue, 21 Jun 1994 18:35:42 -0700
Received: from localhost (localhost [127.0.0.1]) by faerie.CS.Berkeley.EDU (8.6.4/8.1B) with SMTP id SAA15473; Tue, 21 Jun 1994 18:35:37 -0700
Message-Id: <199406220135.SAA15473@faerie.CS.Berkeley.EDU>
X-Authentication-Warning: faerie.CS.Berkeley.EDU: Host localhost didn't use HELO protocol
From: aoki@CS.Berkeley.EDU (Paul M. Aoki)
To: dunlop@ists.ists.ca (J. Douglas Dunlop)
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: pgperl for 4.2? 
Reply-To: aoki@CS.Berkeley.EDU (Paul M. Aoki)
In-reply-to: Your message of Tue, 21 Jun 1994 20:21:46 -0400 
	     <94Jun21.202153edt.98717@ists.ists.ca> 
Date: Tue, 21 Jun 94 18:35:37 -0700
X-Sender: aoki@postgres.Berkeley.EDU
Resent-To: postgres-redist@postgres.Berkeley.EDU
X-Mts: smtp
Resent-Date: Tue, 21 Jun 94 18:35:43 -0700
Resent-XMts: smtp

dunlop@ists.ists.ca (J. Douglas Dunlop) writes:
> >this is my cheap hack for dealing with it.  your actual mileage, as
> >always, may vary.
> Sorry to say that my mileage did vary.

you might have missed this patch for src/backend/libpq/portal.c that 
was mumbled-about a few months ago.

(i have thus far successfully resisted getting organized about patches..
i know it's inconvenient, sorry.)

*** 1.18	1994/02/01 20:39:07
--- 1.19	1994/04/21 20:36:58
***************
*** 50,56 ****
   *	see utils/mmgr/portalmem.c for why. -cim 2/22/91
   *
   *   IDENTIFICATION
!  *	$Header: /faerie/aoki/postgres/src/backend/libpq/RCS/portal.c,v 1.18 1994/02/01 20:39:07 jolly Exp $
   * ----------------------------------------------------------------
   */
  
--- 50,56 ----
   *	see utils/mmgr/portalmem.c for why. -cim 2/22/91
   *
   *   IDENTIFICATION
!  *	$Header: /faerie/aoki/postgres/src/backend/libpq/RCS/portal.c,v 1.19 1994/04/21 20:36:58 aoki Exp $
   * ----------------------------------------------------------------
   */
  
***************
*** 61,67 ****
  #include "tmp/libpq.h"
  #include "utils/exc.h"
  
! RcsId("$Header: /faerie/aoki/postgres/src/backend/libpq/RCS/portal.c,v 1.18 1994/02/01 20:39:07 jolly Exp $");
  
  /* ----------------
   *	exceptions
--- 61,67 ----
  #include "tmp/libpq.h"
  #include "utils/exc.h"
  
! RcsId("$Header: /faerie/aoki/postgres/src/backend/libpq/RCS/portal.c,v 1.19 1994/04/21 20:36:58 aoki Exp $");
  
  /* ----------------
   *	exceptions
***************
*** 190,196 ****
--- 190,202 ----
  /* --------------------------------
   *	PQpnames - Return all the portal names
   * 	If rule_p, only return asynchronous portals. 
+  *
   *         the caller must have allocated sufficient memory for char** pnames
+  *	   (an array of PQnportals strings of length PortalNameLength).
+  *
+  *	   notice that this assumes that the user is calling PQnportals and
+  *	   PQpnames with the same rule_p argument, and with no intervening
+  *	   portal closures.  if not, you can get in heap big trouble..
   * --------------------------------
   */
  void
***************
*** 198,204 ****
      char **pnames;
      int rule_p;
  {
!     int i;
      
      if (!valid_pointer("PQpnames: invalid name buffer", pnames))
  	return;
--- 204,210 ----
      char **pnames;
      int rule_p;
  {
!     int i, cur_pname = 0;
      
      if (!valid_pointer("PQpnames: invalid name buffer", pnames))
  	return;
***************
*** 206,216 ****
      for (i = 0; i < portals_array_size; ++i) {
  	if (portals[i] && portals[i]->portal) {
  	    if (!rule_p || portals[i]->portal->rule_p) {
! 		(void) strncpy(pnames[i], portals[i]->name, PortalNameLength);
! 		continue;
  	    }
  	}
- 	pnames[i][0] = '\0';
      }
  }
  
--- 212,221 ----
      for (i = 0; i < portals_array_size; ++i) {
  	if (portals[i] && portals[i]->portal) {
  	    if (!rule_p || portals[i]->portal->rule_p) {
! 		(void) strncpy(pnames[cur_pname], portals[i]->name, PortalNameLength);
! 		++cur_pname;
  	    }
  	}
      }
  }
  
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  aoki@CS.Berkeley.EDU
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki

==============================================================================
   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.
==============================================================================
