File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.118 2002/04/08 03:48:10 ishii Exp $
11
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.119 2002/04/15 23:35:51 momjian Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -1510,8 +1510,16 @@ getNotify(PGconn *conn)
1510
1510
return EOF ;
1511
1511
if (pqGets (& conn -> workBuffer , conn ))
1512
1512
return EOF ;
1513
- newNotify = (PGnotify * ) malloc (sizeof (PGnotify ));
1514
- strncpy (newNotify -> relname , conn -> workBuffer .data , NAMEDATALEN );
1513
+
1514
+ /*
1515
+ * Store the relation name right after the PQnotify structure so it can
1516
+ * all be freed at once. We don't use NAMEDATALEN because we don't
1517
+ * want to tie this interface to a specific server name length.
1518
+ */
1519
+ newNotify = (PGnotify * ) malloc (sizeof (PGnotify ) +
1520
+ strlen (conn -> workBuffer .data ) + 1 );
1521
+ newNotify -> relname = (char * )newNotify + sizeof (PGnotify );
1522
+ strcpy (newNotify -> relname , conn -> workBuffer .data );
1515
1523
newNotify -> be_pid = be_pid ;
1516
1524
DLAddTail (conn -> notifyList , DLNewElem (newNotify ));
1517
1525
return 0 ;
Original file line number Diff line number Diff line change 7
7
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $Id: libpq-fe.h,v 1.83 2002/03/05 06:07:26 momjian Exp $
10
+ * $Id: libpq-fe.h,v 1.84 2002/04/15 23:35:51 momjian Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -105,8 +105,7 @@ typedef struct pg_result PGresult;
105
105
*/
106
106
typedef struct pgNotify
107
107
{
108
- char relname [NAMEDATALEN ]; /* name of relation containing
109
- * data */
108
+ char * relname ; /* name of relation containing data */
110
109
int be_pid ; /* process id of backend */
111
110
} PGnotify ;
112
111
You can’t perform that action at this time.
0 commit comments