summaryrefslogtreecommitdiff
path: root/src/librandom/randomegd_open.c
blob: 7c43f0d8aba76cdd7290899e37a899afbbb8a1f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* ISC license. */

#include <errno.h>
#include <skalibs/djbunix.h>
#include <skalibs/webipc.h>
#include <skalibs/randomegd.h>

int randomegd_open (char const *path)
{
  int s = ipc_stream() ;
  if (s < 0) return -1 ;
  if (ipc_connect(s, path) == -1)
  {
    register int e = errno ;
    fd_close(s) ;
    errno = e ;
    return -1 ;
  }
  return s ;
}