agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Paul M. Aoki <aoki@CS.Berkeley.EDU>
To: J. Douglas Dunlop <dunlop@ists.ists.ca>
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: pgperl for 4.2?
Date: Tue, 21 Jun 94 18:35:37 -0700
Message-ID: <199406220135.SAA15473@faerie.CS.Berkeley.EDU> (raw)
In-Reply-To: <94Jun21.202153edt.98717@ists.ists.ca>

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



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: aoki@CS.Berkeley.EDU, dunlop@ists.ists.ca
  Subject: Re: pgperl for 4.2?
  In-Reply-To: <199406220135.SAA15473@faerie.CS.Berkeley.EDU>

* 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