From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Two coverity non-bugs |
Date: | 2006-04-19 16:03:10 |
Message-ID: | 29153.1145462590@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> Attached is a patch that fixes two non-bugs. There's plenty of
> redundant NULL checks around the place but these were just so silly I
> figure they're worth fixing.
Applied in the following modified form.
regards, tom lane
Index: src/bin/psql/prompt.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/prompt.c,v
retrieving revision 1.43
diff -c -r1.43 prompt.c
*** src/bin/psql/prompt.c 5 Mar 2006 15:58:52 -0000 1.43
--- src/bin/psql/prompt.c 19 Apr 2006 16:00:32 -0000
***************
*** 250,263 ****
/* execute command */
case '`':
{
! FILE *fd = NULL;
char *file = pg_strdup(p + 1);
int cmdend;
cmdend = strcspn(file, "`");
file[cmdend] = '\0';
! if (file)
! fd = popen(file, "r");
if (fd)
{
fgets(buf, MAX_PROMPT_SIZE - 1, fd);
--- 250,262 ----
/* execute command */
case '`':
{
! FILE *fd;
char *file = pg_strdup(p + 1);
int cmdend;
cmdend = strcspn(file, "`");
file[cmdend] = '\0';
! fd = popen(file, "r");
if (fd)
{
fgets(buf, MAX_PROMPT_SIZE - 1, fd);
Index: src/bin/pg_dump/pg_backup_archiver.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.126
diff -c -r1.126 pg_backup_archiver.c
*** src/bin/pg_dump/pg_backup_archiver.c 12 Apr 2006 22:18:48 -0000 1.126
--- src/bin/pg_dump/pg_backup_archiver.c 19 Apr 2006 16:00:32 -0000
***************
*** 2203,2209 ****
PQExpBuffer qry;
if (!schemaName || *schemaName == '\0' ||
! strcmp(AH->currSchema, schemaName) == 0)
return; /* no need to do anything */
qry = createPQExpBuffer();
--- 2203,2209 ----
PQExpBuffer qry;
if (!schemaName || *schemaName == '\0' ||
! (AH->currSchema && strcmp(AH->currSchema, schemaName) == 0))
return; /* no need to do anything */
qry = createPQExpBuffer();
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-04-19 16:16:31 | Re: [PATCH] Tiny memleak in libpq |
Previous Message | Martijn van Oosterhout | 2006-04-19 15:36:21 | [PATCH] Tiny memleak in libpq |