Fix pgbench to handle empty lines in script files as documented.
authorTatsuo Ishii <ishii@postgresql.org>
Tue, 15 Aug 2006 13:05:30 +0000 (13:05 +0000)
committerTatsuo Ishii <ishii@postgresql.org>
Tue, 15 Aug 2006 13:05:30 +0000 (13:05 +0000)
patches contributed by Itagaki Takahiro.

contrib/pgbench/pgbench.c

index 41de5591dc875f4fa288ec5fcdad81f5d7416980..4d336bfd370ed1198206691b6026ef5b1b1fe87b 100644 (file)
@@ -4,7 +4,7 @@
  * pgbench: a simple benchmark program for PostgreSQL
  * written by Tatsuo Ishii
  *
- * Copyright (c) 2000-2005     Tatsuo Ishii
+ * Copyright (c) 2000-2006     Tatsuo Ishii
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
@@ -1006,7 +1006,7 @@ process_file(char *filename)
                while (isspace((unsigned char) buf[i]))
                        i++;
 
-               if (strncmp(&buf[i], "\n", 1) != 0 && strncmp(&buf[i], "--", 2) != 0) {
+               if (buf[i] != '\0' && strncmp(&buf[i], "--", 2) != 0) {
                        commands = process_commands(&buf[i]);
                        if (commands == NULL)
                        {