7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.30 1999/05/09 00:54:30 tgl Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.31 1999/05/09 15: 00:18 ishii Exp $
11
11
*
12
12
* NOTES
13
13
* This should be moved to a more appropriate place. It is here
@@ -131,6 +131,9 @@ lo_close(int fd)
131
131
int
132
132
lo_read (int fd , char * buf , int len )
133
133
{
134
+ MemoryContext currentContext ;
135
+ int status ;
136
+
134
137
if (fd < 0 || fd >= MAX_LOBJ_FDS )
135
138
{
136
139
elog (ERROR , "lo_read: large obj descriptor (%d) out of range" , fd );
@@ -141,13 +144,20 @@ lo_read(int fd, char *buf, int len)
141
144
elog (ERROR , "lo_read: invalid large obj descriptor (%d)" , fd );
142
145
return -3 ;
143
146
}
147
+ currentContext = MemoryContextSwitchTo ((MemoryContext ) fscxt );
148
+
149
+ status = inv_read (cookies [fd ], buf , len );
144
150
145
- return inv_read (cookies [fd ], buf , len );
151
+ MemoryContextSwitchTo (currentContext );
152
+ return (status );
146
153
}
147
154
148
155
int
149
156
lo_write (int fd , char * buf , int len )
150
157
{
158
+ MemoryContext currentContext ;
159
+ int status ;
160
+
151
161
if (fd < 0 || fd >= MAX_LOBJ_FDS )
152
162
{
153
163
elog (ERROR , "lo_write: large obj descriptor (%d) out of range" , fd );
@@ -158,8 +168,12 @@ lo_write(int fd, char *buf, int len)
158
168
elog (ERROR , "lo_write: invalid large obj descriptor (%d)" , fd );
159
169
return -3 ;
160
170
}
171
+ currentContext = MemoryContextSwitchTo ((MemoryContext ) fscxt );
172
+
173
+ status = inv_write (cookies [fd ], buf , len );
161
174
162
- return inv_write (cookies [fd ], buf , len );
175
+ MemoryContextSwitchTo (currentContext );
176
+ return (status );
163
177
}
164
178
165
179
0 commit comments