~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to gnulib-tests/connect.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- buffer-read-only: t -*- vi: set ro: */
2
 
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3
1
/* connect.c --- wrappers for Windows connect function
4
2
 
5
 
   Copyright (C) 2008-2011 Free Software Foundation, Inc.
 
3
   Copyright (C) 2008-2012 Free Software Foundation, Inc.
6
4
 
7
5
   This program is free software: you can redistribute it and/or modify
8
6
   it under the terms of the GNU General Public License as published by
34
32
rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len)
35
33
{
36
34
  SOCKET sock = FD_TO_SOCKET (fd);
37
 
  int r = connect (sock, sockaddr, len);
38
 
  if (r < 0)
39
 
    {
40
 
      /* EINPROGRESS is not returned by WinSock 2.0; for backwards
41
 
         compatibility, connect(2) uses EWOULDBLOCK.  */
42
 
      if (WSAGetLastError () == WSAEWOULDBLOCK)
43
 
        WSASetLastError (WSAEINPROGRESS);
44
 
 
45
 
      set_winsock_errno ();
46
 
    }
47
 
 
48
 
  return r;
 
35
 
 
36
  if (sock == INVALID_SOCKET)
 
37
    {
 
38
      errno = EBADF;
 
39
      return -1;
 
40
    }
 
41
  else
 
42
    {
 
43
      int r = connect (sock, sockaddr, len);
 
44
      if (r < 0)
 
45
        {
 
46
          /* EINPROGRESS is not returned by WinSock 2.0; for backwards
 
47
             compatibility, connect(2) uses EWOULDBLOCK.  */
 
48
          if (WSAGetLastError () == WSAEWOULDBLOCK)
 
49
            WSASetLastError (WSAEINPROGRESS);
 
50
 
 
51
          set_winsock_errno ();
 
52
        }
 
53
 
 
54
      return r;
 
55
    }
49
56
}