diff options
| author | Russ White <russ@riw.us> | 2017-01-25 15:04:49 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-25 15:04:49 -0500 |
| commit | dfa7df29a8a3335d85f8825063d9334652ae7e4b (patch) | |
| tree | 2fbb6588bab2ec9ec3c513236beb409a3174e5e5 /lib/sockopt.c | |
| parent | 1ef15f4685db67088134abfd5f9c1fc1275e0d7a (diff) | |
| parent | 38657f2ebd65fce3cfcba3ff4d29b29056af2df1 (diff) | |
Merge pull request #120 from opensourcerouting/snapcraft-base-v3
Snapcraft base changes
Diffstat (limited to 'lib/sockopt.c')
| -rw-r--r-- | lib/sockopt.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c index 461e1f7f54..570b575a7a 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -29,6 +29,29 @@ #include "sockopt.h" #include "sockunion.h" +/* Replace the path of given defaultpath with newpath, but keep filename */ +void +set_socket_path (char *path, char *defaultpath, char *newpath, int maxsize) +{ + char *sock_name; + + sock_name = strrchr(defaultpath, '/'); + if (sock_name) + /* skip '/' */ + sock_name++; + else + /* + * VTYSH_PATH configured as relative path + * during config? Should really never happen for + * sensible config + */ + sock_name = defaultpath; + + strlcpy (path, newpath, maxsize); + strlcat (path, "/", maxsize); + strlcat (path, sock_name, maxsize); +} + void setsockopt_so_recvbuf (int sock, int size) { |
