title: failed creating Unix socket
body: <p>Please i will first like to state that, i don't know how to program in C. This is a software which i am trying to get running that gives me this error. So the name of the executable file is called BGPdb_ctl2 which is part of a big program.This program was written about 9 years ago. When BGPdb_ctl2 is run by the main program, i have an error which is under the domain of "failed creating unix socket", so i went to the src of the program to take a look at the source code of BGPdb_ctl2 and find where "failed in connect" is. which is here :</p>
  
  <pre><code>ret = connect(sock, (struct sockaddr *) &amp;addr, addr_len);
  if ( ret == -1 ) {
      err( EXIT_FAILURE, "failed in connect" );
  }
  </code></pre>
  
  <p>So i don't really know why -1 is returned. Maybe it's an old deprecated method etc ? no idea but it seemed to work 8 years ago from the developers. I am using Ubuntu 13.04.</p>
  
  <p><strong>This is the full code :</strong></p>
  
  <pre><code> #include &lt;sys/stat.h&gt;
   #include &lt;sys/socket.h&gt;
   #include &lt;sys/types.h&gt;
   #include &lt;sys/un.h&gt;
   #include &lt;err.h&gt;
   #include &lt;errno.h&gt;
   #include &lt;stdio.h&gt;
   #include &lt;stdlib.h&gt;
   #include &lt;unistd.h&gt;
  
  
   extern int errno;
  
   int main( int argc, char **argv ) {
       int ret;
       int sock;
       struct sockaddr_un addr;
       socklen_t addr_len;
       char command[64];
       int length;
       char buff[128];
  
       /* CHECK: Add a getopts thing here... right now, I'm lazy... */
  
       sock = socket( AF_UNIX, SOCK_STREAM, 0 );
       if ( sock == -1 ) {
           err( EXIT_FAILURE, "failed creating unix_socket" );
       }
  
       memset( &amp;addr, 0, sizeof(struct sockaddr_un) );
       addr.sun_family = AF_UNIX;
       strcpy( addr.sun_path, DBDIR );
       strcat( addr.sun_path, "loader.socket" );
  
       addr_len = sizeof(addr.sun_family) + 
       strlen(addr.sun_path);
  
       ret = connect(sock, (struct sockaddr *) &amp;addr, addr_len);
       if ( ret == -1 ) { 
           err( EXIT_FAILURE, "failed in connect" );
       }
  
       if ( argc != 2 ) {
           errx( EXIT_FAILURE, "usage: prefserv-ctl command\n\tcommand\t"
                "load - load update files\n\n" );
       }
  
       snprintf( command, 64, "%s\n", argv[1] );
       ret = send( sock, command, strlen(command), 0 );
       memset ( &amp;command, 0,sizeof(command));
       memset ( &amp;buff, 0,sizeof(command));
       while( (length = recv(sock, buff, 128, 0)) &gt; 0 ) {
           sscanf( buff, "%63s", command );
           if ( strcmp( command, "done" ) == 0 ) {
               break;
               }
           }
  
       return 0;
   }
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>This is a file that also has something to do with the <strong>loader.socket</strong> The file is called
  <strong>loader.server</strong></p>
  
  <pre><code> ret = bind(unix_sock, (struct sockaddr *) &amp;unix_addr, unix_addr_len);
      if ( ret == -1 ) {
          warn( "failed in bind" );
          return ((void *) NULL);
      }
  
   ret = listen( unix_sock, 1 /* Number to log */ );
      if ( ret == -1 ) {
          warn( "failed in bind" );
          return ((void *) NULL);
  </code></pre>
  
  <p>Please if you need more code, don't hesitate to ask. Any trival debugging tips are greatly welcome.</p>