summaryrefslogtreecommitdiff
path: root/src/libs6net/s6net_ident_error.c
blob: fca41fcd2fada9bf91b4a0b012b65229a75fbe1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* ISC license */

#include <errno.h>
#include <skalibs/error.h>
#include <s6-networking/ident.h>

#define N 5

static char const *s6net_ident_error_strings[N+1] =
{
  "invalid port",
  "no such user",
  "identification denied",
  "unknown error",
  "X-error-token",
  "(invalid error code)"
} ;

static int const s6net_ident_error_codes[N] =
{
  EINVAL,
  ESRCH,
  EPERM,
  EIO,
  EEXIST
} ;

char const *s6net_ident_error_str (int e)
{
  unsigned int i = 0 ;
  for (; i < N ; i++) if (e == s6net_ident_error_codes[i]) break ;
  return s6net_ident_error_strings[i] ;
}