diff options
author | Ondrej Filip <feela@network.cz> | 2004-06-06 19:05:25 +0200 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2004-06-06 19:05:25 +0200 |
commit | 41c8976e29bbf2986b063d1a8c5c8b386fae500e (patch) | |
tree | 129af3a1bde01335521a831a988472c4c963f3b1 /sysdep/unix/io.c | |
parent | cd09226078471cf9a2db4e755fbd5f6f137137c9 (diff) | |
download | bird-41c8976e29bbf2986b063d1a8c5c8b386fae500e.tar bird-41c8976e29bbf2986b063d1a8c5c8b386fae500e.zip |
Test old instance of BIRD.
Diffstat (limited to 'sysdep/unix/io.c')
-rw-r--r-- | sysdep/unix/io.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index 4030b86..ed5b89f 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -1194,3 +1194,23 @@ io_loop(void) } } } + +void +test_old_bird(char *path) +{ + int fd; + struct sockaddr_un sa; + + fd = socket(AF_UNIX, SOCK_STREAM, 0); + + if (fd < 0) + die("Cannot create socket: %m"); + bzero(&sa, sizeof(sa)); + sa.sun_family = AF_UNIX; + strcpy(sa.sun_path, path); + if (connect(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == 0) + die("I found another BIRD running."); + close(fd); +} + + |