Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/lib/packet.c

    r591 r740  
    33   Packet handling
    44   Copyright (C) Volker Lendecke 2007
    5    
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 3 of the License, or
    99   (at your option) any later version.
    10    
     10
    1111   This program is distributed in the hope that it will be useful,
    1212   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1313   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1414   GNU General Public License for more details.
    15    
     15
    1616   You should have received a copy of the GNU General Public License
    1717   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    1919
    2020#include "includes.h"
     21#include "../lib/util/select.h"
     22#include "system/filesys.h"
     23#include "system/select.h"
     24#include "packet.h"
    2125
    2226struct packet_context {
     
    102106}
    103107
    104 NTSTATUS packet_fd_read_sync(struct packet_context *ctx,
    105                              struct timeval *timeout)
    106 {
    107         int res;
    108         fd_set r_fds;
    109 
    110         if (ctx->fd < 0 || ctx->fd >= FD_SETSIZE) {
    111                 errno = EBADF;
    112                 return map_nt_error_from_unix(errno);
    113         }
    114 
    115         FD_ZERO(&r_fds);
    116         FD_SET(ctx->fd, &r_fds);
    117 
    118         res = sys_select(ctx->fd+1, &r_fds, NULL, NULL, timeout);
    119 
     108NTSTATUS packet_fd_read_sync(struct packet_context *ctx, int timeout)
     109{
     110        int res, revents;
     111
     112        res = poll_one_fd(ctx->fd, POLLIN|POLLHUP, timeout, &revents);
    120113        if (res == 0) {
    121                 DEBUG(10, ("select timed out\n"));
     114                DEBUG(10, ("poll timed out\n"));
    122115                return NT_STATUS_IO_TIMEOUT;
    123116        }
    124117
    125118        if (res == -1) {
    126                 DEBUG(10, ("select returned %s\n", strerror(errno)));
    127                 return map_nt_error_from_unix(errno);
     119                DEBUG(10, ("poll returned %s\n", strerror(errno)));
     120                return map_nt_error_from_unix(errno);
     121        }
     122        if ((revents & (POLLIN|POLLHUP|POLLERR)) == 0) {
     123                DEBUG(10, ("socket not readable\n"));
     124                return NT_STATUS_IO_TIMEOUT;
    128125        }
    129126
Note: See TracChangeset for help on using the changeset viewer.