Martijn van Oosterhout <kleptog@svana.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();

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to