Applied patch from #135.

This commit is contained in:
Federico Di Gregorio 2007-02-11 08:25:33 +00:00
parent 09c866221c
commit c2e16b8901
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,7 @@
2007-02-11 Federico Di Gregorio <fog@initd.org> 2007-02-11 Federico Di Gregorio <fog@initd.org>
* psycopg/pqpath.c: ported psycopg1 patch from #135.
* psycopg/connection_type.c: now the password is obfuscated after we try * psycopg/connection_type.c: now the password is obfuscated after we try
to connect to the backend. This really fixes #147. to connect to the backend. This really fixes #147.

View File

@ -716,20 +716,22 @@ _pq_copy_out(cursorObject *curs)
PyObject *tmp = NULL; PyObject *tmp = NULL;
char buffer[4096]; char buffer[4096];
int status, len; int status, len, ll=0;
while (1) { while (1) {
Py_BEGIN_ALLOW_THREADS; Py_BEGIN_ALLOW_THREADS;
status = PQgetline(curs->conn->pgconn, buffer, 4096); status = PQgetline(curs->conn->pgconn, buffer, 4096);
Py_END_ALLOW_THREADS; Py_END_ALLOW_THREADS;
if (status == 0) { if (status == 0) {
if (buffer[0] == '\\' && buffer[1] == '.') break; if (!ll && buffer[0] == '\\' && buffer[1] == '.') break;
len = strlen(buffer); len = strlen(buffer);
buffer[len++] = '\n'; buffer[len++] = '\n';
ll = 0;
} }
else if (status == 1) { else if (status == 1) {
len = 4096-1; len = 4096-1;
ll = 1;
} }
else { else {
return -1; return -1;