~ubuntu-branches/ubuntu/natty/libgpg-error/natty

« back to all changes in this revision

Viewing changes to src/code-from-errno.c

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Meurer
  • Date: 2010-12-16 12:55:05 UTC
  • mfrom: (1.1.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: james.westby@ubuntu.com-20101216125505-zmdtr4zdfnwu5pox
Tags: 1.10-0.1
* Non-maintainer upload.
* New upstream release 1.10. (Closes: #554234)
* Upload to experimental due to squeeze deep freeze
* Add debian/watch file.
* debian/control:
  + Move source package to section libs.
  + Add misc Depends for debhelper.
  + Update short description for libgpg-error-dev
  + Bump standards-version to 3.9.1, no changes required
  + Add Homepage header
  + Set Priority=standard for source package
* debian/rules:
  + Remove unused dpatch patch system implementation and patches
  + Remove unneeded 'chmod +x configure' from configure-stamp target
  + Move libgpg-error0 library to /lib. (Closes: #604945)
  + Fix targets to always depend on target-stamp, add install-stamp
  + Remove '-V 'libgpg-error0 (>= 1.6-1)'' from dh_makeshlibs
* move debian/doc to debian/libgpg-error0.doc:
  + ship NEWS and README in library package, not in dev package
* debian/libgpg-error-dev.install:
  + don't install unavailable libgpg-error.a
* debian/gpg-error(-config).1:
  + Fix manpages, thanks to lintian
* debian/copyright:
  + refer to versioned LGPL 2.1, thanks to lintian

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#endif
24
24
 
25
25
#include <errno.h> 
26
 
#ifdef HAVE_W32_SYSTEM
27
 
#include <winsock2.h>
28
 
#endif
29
26
 
30
27
#include <gpg-error.h>
31
28
 
32
29
#include "code-from-errno.h"
33
30
 
34
 
#ifdef HAVE_W32_SYSTEM
35
 
/* Under Windows socket related error codes are defined in a different
36
 
   file and prefixed with "WSA".  As their ranges don't overlap, we map
37
 
   some of them to our usual error codes. */
38
 
gpg_err_code_t
39
 
w32_special_errnos (int err)
40
 
{
41
 
  switch (err)
42
 
    {
43
 
    case WSAEADDRINUSE:    return GPG_ERR_EADDRINUSE;
44
 
    case WSAEADDRNOTAVAIL: return GPG_ERR_EADDRNOTAVAIL;  
45
 
    case WSAECONNABORTED:  return GPG_ERR_ECONNABORTED;
46
 
    case WSAECONNREFUSED:  return GPG_ERR_ECONNREFUSED;
47
 
    case WSAECONNRESET:    return GPG_ERR_ECONNRESET;
48
 
    case WSAENAMETOOLONG:  return GPG_ERR_ENAMETOOLONG;
49
 
    case WSAEHOSTDOWN:     return GPG_ERR_EHOSTDOWN;
50
 
    case WSAEHOSTUNREACH:  return GPG_ERR_EHOSTUNREACH;
51
 
    default: 
52
 
      return GPG_ERR_UNKNOWN_ERRNO;
53
 
    }
54
 
}
55
 
#endif /*HAVE_W32_SYSTEM*/
56
 
 
57
31
/* Retrieve the error code for the system error ERR.  This returns
58
32
   GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
59
33
   this).  */
68
42
  idx = errno_to_idx (err);
69
43
 
70
44
  if (idx < 0)
71
 
    {
72
 
#ifdef HAVE_W32_SYSTEM
73
 
      return w32_special_errnos (err);
74
 
#else
75
 
      return GPG_ERR_UNKNOWN_ERRNO;
76
 
#endif
77
 
    }
 
45
    return GPG_ERR_UNKNOWN_ERRNO;
78
46
 
79
47
  return GPG_ERR_SYSTEM_ERROR | err_code_from_index[idx];
80
48
}
95
63
  idx = errno_to_idx (err);
96
64
 
97
65
  if (idx < 0)
98
 
    {
99
 
#ifdef HAVE_W32_SYSTEM
100
 
      return w32_special_errnos (err);
101
 
#else
102
 
      return GPG_ERR_UNKNOWN_ERRNO;
103
 
#endif
104
 
    }
 
66
    return GPG_ERR_UNKNOWN_ERRNO;
105
67
 
106
68
  return GPG_ERR_SYSTEM_ERROR | err_code_from_index[idx];
107
69
}