File: ux_client_socket.c

package info (click to toggle)
superd 0.0.3-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 136 kB
  • ctags: 85
  • sloc: ansic: 721; makefile: 103; sh: 27
file content (26 lines) | stat: -rw-r--r-- 623 bytes parent folder | download | duplicates (3)
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
#include "ux_client_socket.h"

int ux_client_socket(const char *pipe) {
  int ux_sd, connectreturned;
  struct sockaddr_un ux_client;
  
  if((ux_sd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
    // replace this with syslog schtuff
    perror("socket");
    exit(1);
  }

  ux_client.sun_family = AF_UNIX;
  strcpy(ux_client.sun_path, pipe);

  connectreturned = connect(ux_sd, (struct sockaddr *)&ux_client, sizeof(ux_client));


  if(connectreturned < 0) {
    // replace this with syslog schtuff
    fprintf(stderr, "unix domain client socket connect error.\n");
    perror("connect");
    exit(2);
  }
  return ux_sd;
}