From: hankin
authorMarc G. Fournier
Sun, 15 Mar 1998 08:18:03 +0000 (08:18 +0000)
committerMarc G. Fournier
Sun, 15 Mar 1998 08:18:03 +0000 (08:18 +0000)
a while back I posted a patch for pg_ident, the patch worked but I didn't
diagnose the problem properly.
on my compiler(gcc2.7.2) this compiles with no errors...

char buf[1000]; if(buf != '\0') {

...but it doesn't compare '\0' with the first char of buf.

src/backend/libpq/hba.c

index 97045ff012c79940a0f15977e52bacfea6ffe7ba..10a2acdc27b85b90494a5937295e6ff949b6243a 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.29 1998/02/26 04:31:49 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.30 1998/03/15 08:18:03 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -662,20 +662,24 @@ parse_map_record(FILE *file,
    file_iuser[0] = '\0';
 
    next_token(file, buf, sizeof(buf));
-   if (buf != '\0')
+   if (buf[0] != '\0')
    {
        strcpy(file_map, buf);
        next_token(file, buf, sizeof(buf));
-       if (buf != '\0')
+       if (buf[0] != '\0')
        {
            strcpy(file_iuser, buf);
            next_token(file, buf, sizeof(buf));
-           if (buf != '\0')
+           if (buf[0] != '\0')
            {
                strcpy(file_pguser, buf);
                read_through_eol(file);
+               return;
            }
        }
+       sprintf(PQerrormsg,"Incomplete line in pg_ident: %s",file_map);
+       fputs(PQerrormsg, stderr);
+       pqdebug("%s", PQerrormsg);
    }
 }