Github user paul-guo- commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/1157#discussion_r103857185
  
    --- Diff: src/backend/executor/nodeShareInputScan.c ---
    @@ -627,38 +627,50 @@ static void create_tmp_fifo(const char *fifoname)
     /* 
      * As all other read/write in postgres, we may be interrupted so retry is 
needed.
      */
    -static int retry_read(int fd, char *buf, int rsize)
    +static int retry_read(int *fd, char *buf, int rsize)
     {
        int sz;
        Assert(rsize > 0);
     
     read_retry:
    -   sz = read(fd, buf, rsize);
    +   sz = read(*fd, buf, rsize);
        if (sz > 0)
                return sz;
    -   else if(sz == 0 || errno == EINTR)
    +   else if(sz == 0) // read EOF 
    +           return 0;
    +   else if(errno == EINTR)
                goto read_retry;
        else
        {
    +           if(*fd >= 0)
    +           {
    +                   gp_retry_close(fd);
    +                   *fd = -1;
    +           }
                elog(ERROR, "could not read from fifo: %m");
        }
        Assert(!"Never be here");
        return 0;
    --- End diff --
    
    Although this will never be reached, but I'd suggest -1 for return value.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to