Home | History | Annotate | Download | only in tests
      1 #include <fcntl.h>
      2 #include <stdio.h>
      3 #include <stdlib.h>
      4 #include <sys/socket.h>
      5 #include <unistd.h>
      6 
      7 int main(int argc, char **argv)
      8 {
      9    int s;
     10 
     11    if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0)
     12    {
     13       perror("socket");
     14       exit(1);
     15    }
     16 
     17    if (fcntl(s, F_SETOWN, getpid()) < 0)
     18    {
     19       perror("fcntl(F_SETOWN)");
     20       exit(1);
     21    }
     22 
     23    if (close(s) < 0)
     24    {
     25       perror("close");
     26       exit(1);
     27    }
     28 
     29    exit(0);
     30 }
     31