~ubuntu-branches/ubuntu/maverick/mpop/maverick

« back to all changes in this revision

Viewing changes to gnulib/setsockopt.c

  • Committer: Bazaar Package Importer
  • Author(s): Emmanuel Bouthenot
  • Date: 2009-08-14 18:08:48 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090814180848-f31eii74n1dnzimr
Tags: 1.0.17-1
* New upstream release (Closes: #513223)
* Adopting the package: setting me as maintainer.
* Add a Homepage field.
* Bump Standards-Version to 3.8.2.
* Update debian/copyright:
  - point to the GPLv3 licence from /usr/share/common-licences
    instead of including the whole licence.
  - Add new copyright holders.
  - Cleaning and refactoring.
* Add Vcs-Git and Vcs-Browser fields.
* Switch packaging from CDBS to "plain debhelper".
* Update debian/compat to version 7.
* New binary package mpop-gnome (mpop with GNOME keyring support)
  which depends on "standard" mpop package and diverts /usr/bin/mpop.
* Update patch which fixes lintian warnings about hyphens in mpop
  manpage.
* Add DM-Upload-Allowed field.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* setsockopt.c --- wrappers for Windows setsockopt function
 
2
 
 
3
   Copyright (C) 2008-2009 Free Software Foundation, Inc.
 
4
 
 
5
   This program is free software: you can redistribute it and/or modify
 
6
   it under the terms of the GNU General Public License as published by
 
7
   the Free Software Foundation; either version 3 of the License, or
 
8
   (at your option) any later version.
 
9
 
 
10
   This program is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
   GNU General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU General Public License
 
16
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
17
 
 
18
/* Written by Paolo Bonzini */
 
19
 
 
20
#include <config.h>
 
21
 
 
22
#define WIN32_LEAN_AND_MEAN
 
23
/* Get winsock2.h. */
 
24
#include <sys/socket.h>
 
25
 
 
26
/* Get struct timeval. */
 
27
#include <sys/time.h>
 
28
 
 
29
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
 
30
#include "w32sock.h"
 
31
 
 
32
#undef setsockopt
 
33
 
 
34
int
 
35
rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
 
36
{
 
37
  int r;
 
38
  SOCKET sock = FD_TO_SOCKET (fd);
 
39
 
 
40
  if (level == SOL_SOCKET && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
 
41
    {
 
42
      const struct timeval *tv = optval;
 
43
      int milliseconds = tv->tv_sec * 1000 + tv->tv_usec / 1000;
 
44
      r = setsockopt (sock, level, optname, &milliseconds, sizeof (int));
 
45
    }
 
46
  else
 
47
    {
 
48
      r = setsockopt (sock, level, optname, optval, optlen);
 
49
    }
 
50
 
 
51
  if (r < 0)
 
52
    set_winsock_errno ();
 
53
 
 
54
  return r;
 
55
}