Re: wierd problems with DBI/DBD::pg?

Поиск
Список
Период
Сортировка
От pmh@edison.ioppublishing.com
Тема Re: wierd problems with DBI/DBD::pg?
Дата
Msg-id PGM.20010501111802.23899.359@edison.ioppublishing.com
обсуждение исходный текст
Ответ на wierd problems with DBI/DBD::pg?  (Michelle Murrain <mpm@norwottuck.com>)
Список pgsql-general
On Mon, 30 Apr 2001 14:50:15 -0400, Michelle Murrain wrote:
> I recently upgraded from 6.5 to 7.1, and it mostly went smoothly (fixed the
> PHP problem, thanks to a list member). But now some of my perl stuff is
> being  a bit strange, and I'm wondering whether other folks have noticed
> strangeness  when they upgraded their Postgres as well as upgraded to the
> new DBD::Pg.

Here's a patch to DBD::Pg 0.98, which should fix the problems.

--- dbdimp.c.orig       Tue May  1 11:46:47 2001
+++ dbdimp.c    Tue May  1 11:55:26 2001
@@ -72,18 +72,21 @@
     char *error_msg;
 {
     D_imp_xxh(h);
-    char *err, *src, *dst;
+    char *err, *src, *dst, *end;
     int  len  = strlen(error_msg);

-    err = (char *)malloc(strlen(error_msg + 1));
+    err = (char *)malloc(len + 1);
     if (!err) {
       return;
     }
+    /* Remove trailing newlines, allowing for multi-line messages */
+    for(end = error_msg + len; end > error_msg && end[-1] == '\n'; --end);
+
     src = error_msg;
     dst = err;

     /* copy error message without trailing newlines */
-    while (*dst != '\0' && *dst != '\n') {
+    while (src < end){
         *dst++ = *src++;
     }
     *dst = '\0';


--
    Peter Haworth    pmh@edison.ioppublishing.com
"It's gotten to the point where the only place you can get work done is at
home, because no one bugs you, and the best place to entertain yourself is
at work, because the Internet connections are faster."      -- Scott Adams

В списке pgsql-general по дате отправления:

Предыдущее
От: Michelle Murrain
Дата:
Сообщение: Re: wierd problems with DBI/DBD::pg?
Следующее
От: Fran Fabrizio
Дата:
Сообщение: Stranger than fiction...