Skip to content

Commit

Permalink
Remove unused function ni_local_socket_connect
Browse files Browse the repository at this point in the history
This function goes back to the early days of wicked when it was
using a REST interface served via an AF_LOCAL socket. This stuff
has been for a few years, so it's time to say goodbye to some of
its supporting functions.

Signed-off-by: Olaf Kirch <okir@suse.de>
  • Loading branch information
okirch committed Sep 9, 2014
1 parent e3a086c commit 121911f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 46 deletions.
1 change: 0 additions & 1 deletion include/wicked/socket.h
Expand Up @@ -40,7 +40,6 @@ extern const ni_timer_t *ni_timer_rearm(const ni_timer_t *, unsigned long);
extern long ni_timer_next_timeout(void);
extern int ni_timer_get_time(struct timeval *tv);

extern ni_socket_t * ni_local_socket_connect(const char *);
extern int ni_local_socket_pair(ni_socket_t **, ni_socket_t **);

extern ni_socket_t * ni_socket_hold(ni_socket_t *);
Expand Down
45 changes: 0 additions & 45 deletions src/socket.c
Expand Up @@ -303,51 +303,6 @@ ni_socket_close(ni_socket_t *sock)
ni_socket_release(sock);
}

/*
* Connect to a local unix socket
*/
ni_socket_t *
ni_local_socket_connect(const char *path)
{
int fd;

if (!path) {
ni_error("cannot connect to server - no server socket path specified");
return NULL;
}

fd = socket(AF_LOCAL, SOCK_STREAM, 0);
if (fd < 0) {
ni_error("cannot open AF_LOCAL socket: %m");
return NULL;
}

{
struct sockaddr_un sun;
unsigned int len = strlen(path);

if (len + 1 > sizeof(sun.sun_path)) {
ni_error("can't set AF_LOCAL address: path too long!");
goto failed;
}

memset(&sun, 0, sizeof(sun));
sun.sun_family = AF_LOCAL;
strcpy(sun.sun_path, path);

if (connect(fd, (struct sockaddr *) &sun, sizeof(sun)) < 0) {
ni_error("connect(%s) failed: %m", path);
goto failed;
}
}

return ni_socket_wrap(fd, SOCK_STREAM);

failed:
close(fd);
return NULL;
}

/*
* Create a local socket pair
*/
Expand Down

0 comments on commit 121911f

Please sign in to comment.