diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-01-28 16:21:14 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-28 16:23:06 +0100 |
commit | dbb7eca6559e970bd015eaa95a9e0525660fa09e (patch) | |
tree | 44a01d5e354827c114f0a3c88f0339312243d31c /src/control | |
parent | 6ea14c3624c0cbcf90e7d5859b4af629523b8d82 (diff) |
Remove unused hostname resolution in shm plugins and aserver
PCM and control shm plugins and aserver have some codes to resolve the
host address and check whether it's a local host although the given
address is never used. In addition, the code contains gethostbyname()
that is known to be obsoleted. So, let's get rid of all these unused
codes.
The host configuration item is still accepted (but just ignored) for
keeping the compatibility.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/control_shm.c | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/src/control/control_shm.c b/src/control/control_shm.c index abab3983..40bc705d 100644 --- a/src/control/control_shm.c +++ b/src/control/control_shm.c @@ -441,29 +441,6 @@ static int make_local_socket(const char *filename) return sock; } -#if 0 -static int make_inet_socket(const char *host, int port) -{ - struct sockaddr_in addr; - int sock; - struct hostent *h = gethostbyname(host); - if (!h) - return -ENOENT; - - sock = socket(PF_INET, SOCK_STREAM, 0); - if (sock < 0) - return -errno; - - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - memcpy(&addr.sin_addr, h->h_addr_list[0], sizeof(struct in_addr)); - - if (connect(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) - return -errno; - return sock; -} -#endif - int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname, const char *sname, int mode) { snd_ctl_t *ctl; @@ -565,12 +542,10 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c const char *server = NULL; const char *ctl_name = NULL; snd_config_t *sconfig; - const char *host = NULL; const char *sockname = NULL; long port = -1; int err; - int local; - struct hostent *h; + snd_config_for_each(i, next, conf) { snd_config_t *n = snd_config_iterator_entry(i); const char *id; @@ -624,14 +599,8 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c continue; if (strcmp(id, "comment") == 0) continue; - if (strcmp(id, "host") == 0) { - err = snd_config_get_string(n, &host); - if (err < 0) { - SNDERR("Invalid type for %s", id); - goto _err; - } + if (strcmp(id, "host") == 0) continue; - } if (strcmp(id, "socket") == 0) { err = snd_config_get_string(n, &sockname); if (err < 0) { @@ -653,24 +622,10 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c goto _err; } - if (!host) { - SNDERR("host is not defined"); - goto _err; - } if (!sockname) { SNDERR("socket is not defined"); goto _err; } - h = gethostbyname(host); - if (!h) { - SNDERR("Cannot resolve %s", host); - goto _err; - } - local = snd_is_local(h); - if (!local) { - SNDERR("%s is not the local host", host); - goto _err; - } err = snd_ctl_shm_open(handlep, name, sockname, ctl_name, mode); _err: snd_config_delete(sconfig); |