]> Zhao Yanbai Git Server - minix.git/commitdiff
PFS: fix negative array index
authorThomas Veerman <thomas@minix3.org>
Wed, 18 Jul 2012 10:05:50 +0000 (10:05 +0000)
committerThomas Veerman <thomas@minix3.org>
Wed, 18 Jul 2012 10:05:50 +0000 (10:05 +0000)
servers/pfs/dev_uds.c

index b57e2c65763f1fe186a9389e4715ac3216015487..d5e9a212740aef3583da7e701beed2c453d54c8b 100644 (file)
@@ -551,10 +551,13 @@ static int uds_perform_write(int minor, endpoint_t m_source,
                                break;
                        }
                }
+       }
 
-               if (peer == -1) {
-                       return ENOENT;
-               }
+       if (peer == -1) {
+               if (pretend)
+                       return SUSPEND;
+
+               return ENOENT;
        }
 
        /* check if write would overrun buffer. check if message
@@ -565,7 +568,7 @@ static int uds_perform_write(int minor, endpoint_t m_source,
        if ((uds_fd_table[peer].pos+uds_fd_table[peer].size+size > PIPE_BUF) ||
                ((uds_fd_table[minor].type == SOCK_SEQPACKET ||
                uds_fd_table[minor].type == SOCK_DGRAM) &&
-               uds_fd_table[peer].size > 0) || (peer == -1)) {
+               uds_fd_table[peer].size > 0)) {
 
                if (pretend) {
                        return SUSPEND;