aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2010-05-21 17:37:44 +0000
committerRobert Haas <rhaas@postgresql.org>2010-05-21 17:37:44 +0000
commitc8518845de62e64eec3d863d4e149da72cacdd9f (patch)
treeb20c18988e7fd0fac4547890ff70c69cab057713
parent15ab0e9a6051ff5b6c88a729ddd9d57ac44f7a11 (diff)
downloadpostgresql-c8518845de62e64eec3d863d4e149da72cacdd9f.tar.gz
postgresql-c8518845de62e64eec3d863d4e149da72cacdd9f.zip
Unbreak \h; can't do strlen(NULL).
This was broken by the following commmit. Although the original commit was backpatched all the way to 7.4, this particular bug exists only in the version applied to HEAD. http://archives.postgresql.org/pgsql-committers/2010-05/msg00058.php
-rw-r--r--src/bin/psql/command.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index b9624451c35..46cc0b6f699 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.219 2010/05/08 16:39:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.220 2010/05/21 17:37:44 rhaas Exp $
*/
#include "postgres_fe.h"
#include "command.h"
@@ -654,10 +654,14 @@ exec_command(const char *cmd,
size_t len;
/* strip any trailing spaces and semicolons */
- len = strlen(opt);
- while (len > 0 &&
- (isspace((unsigned char) opt[len - 1]) || opt[len - 1] == ';'))
- opt[--len] = '\0';
+ if (opt)
+ {
+ len = strlen(opt);
+ while (len > 0 &&
+ (isspace((unsigned char) opt[len - 1])
+ || opt[len - 1] == ';'))
+ opt[--len] = '\0';
+ }
helpSQL(opt, pset.popt.topt.pager);
free(opt);