SHARE
TWEET

Untitled

a guest Jun 17th, 2013 29 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int lxc_monitor_open(void)
  2. {
  3. ``struct sockaddr_un addr = { .sun_family = AF_UNIX };
  4. ``char *offset = &addr.sun_path[1];
  5. ``int fd;
  6.  
  7. ``strcpy(offset, "lxc-monitor");
  8.  
  9. ``fd = socket(PF_UNIX, SOCK_DGRAM, 0);
  10. ``if (fd < 0) {
  11. ````ERROR("socket : %s", strerror(errno));
  12. ````return -1;
  13. ``}
  14.  
  15. ``if (bind(fd, (struct sockaddr *)&addr, sizeof(addr))) {
  16. ````ERROR("bind : %s", strerror(errno));
  17. ````close(fd);
  18. ````return -1;
  19. ``}
  20.  
  21. ``return fd;
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top