utils.c (alsa-utils-1.2.5.tar.bz2) | : | utils.c (alsa-utils-1.2.5.1.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stddef.h> | #include <stddef.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
#include <fcntl.h> | #include <fcntl.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <ctype.h> | #include <ctype.h> | |||
#include <dirent.h> | #include <dirent.h> | |||
#include <syslog.h> | #include <syslog.h> | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#include <sys/mman.h> | #include <sys/mman.h> | |||
#include <limits.h> | ||||
#include "alsactl.h" | #include "alsactl.h" | |||
int file_map(const char *filename, char **buf, size_t *bufsize) | int file_map(const char *filename, char **buf, size_t *bufsize) | |||
{ | { | |||
struct stat stats; | struct stat stats; | |||
int fd; | int fd; | |||
fd = open(filename, O_RDONLY); | fd = open(filename, O_RDONLY); | |||
if (fd < 0) { | if (fd < 0) { | |||
return -1; | return -1; | |||
skipping to change at line 223 | skipping to change at line 224 | |||
lock_fd = state_lock(file, 10); | lock_fd = state_lock(file, 10); | |||
err = lock_fd >= 0 ? snd_input_stdio_open(&in, file, "r") : lock_ fd; | err = lock_fd >= 0 ? snd_input_stdio_open(&in, file, "r") : lock_ fd; | |||
} | } | |||
if (err < 0) { | if (err < 0) { | |||
if (open_failed) | if (open_failed) | |||
*open_failed = 1; | *open_failed = 1; | |||
goto out; | goto out; | |||
} | } | |||
err = snd_config_load(config, in); | err = snd_config_load(config, in); | |||
snd_input_close(in); | snd_input_close(in); | |||
if (lock_fd >= 0) | ||||
state_unlock(lock_fd, file); | ||||
if (err < 0) { | if (err < 0) { | |||
error("snd_config_load error: %s", snd_strerror(err)); | error("snd_config_load error: %s", snd_strerror(err)); | |||
out: | out: | |||
if (lock_fd >= 0) | ||||
state_unlock(lock_fd, file); | ||||
snd_config_delete(config); | snd_config_delete(config); | |||
snd_config_update_free_global(); | snd_config_update_free_global(); | |||
return err; | return err; | |||
} else { | } else { | |||
if (lock_fd >= 0) | ||||
state_unlock(lock_fd, file); | ||||
*top = config; | *top = config; | |||
return 0; | return 0; | |||
} | } | |||
} | } | |||
void snd_card_iterator_init(struct snd_card_iterator *iter, int cardno) | void snd_card_iterator_init(struct snd_card_iterator *iter, int cardno) | |||
{ | { | |||
iter->card = cardno; | iter->card = cardno; | |||
iter->single = cardno >= 0; | iter->single = cardno >= 0; | |||
iter->first = true; | iter->first = true; | |||
iter->name[0] = '\0'; | iter->name[0] = '\0'; | |||
} | } | |||
int snd_card_iterator_sinit(struct snd_card_iterator *iter, const char *cardname ) | int snd_card_iterator_sinit(struct snd_card_iterator *iter, const char *cardname ) | |||
{ | { | |||
int cardno = -1; | int cardno = -1; | |||
if (cardname) { | if (cardname) { | |||
if (strncmp(cardname, "hw:", 3) == 0) | ||||
cardname += 3; | ||||
cardno = snd_card_get_index(cardname); | cardno = snd_card_get_index(cardname); | |||
if (cardno < 0) { | if (cardno < 0) { | |||
error("Cannot find soundcard '%s'...", cardname); | error("Cannot find soundcard '%s'...", cardname); | |||
return cardno; | return cardno; | |||
} | } | |||
} | } | |||
snd_card_iterator_init(iter, cardno); | snd_card_iterator_init(iter, cardno); | |||
return 0; | return 0; | |||
} | } | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 7 lines changed or added |