mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
some commenting
change alogrithm for checking for configuration files git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@273 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
2aad9e3ae2
commit
5844a33f0b
9 changed files with 156 additions and 84 deletions
|
|
@ -48,6 +48,13 @@ PA_MODULE_VERSION(PACKAGE_VERSION)
|
|||
|
||||
#define WHITESPACE "\n\r \t"
|
||||
|
||||
#ifndef DEFAULT_CONFIG_DIR
|
||||
#define DEFAULT_CONFIG_DIR "/etc/polypaudio"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_MATCH_TABLE_FILE DEFAULT_CONFIG_DIR"/match.table"
|
||||
#define DEFAULT_MATCH_TABLE_FILE_USER ".polypaudio/.match.table"
|
||||
|
||||
static const char* const valid_modargs[] = {
|
||||
"table",
|
||||
NULL,
|
||||
|
|
@ -69,9 +76,14 @@ static int load_rules(struct userdata *u, const char *filename) {
|
|||
int n = 0;
|
||||
int ret = -1;
|
||||
struct rule *end = NULL;
|
||||
char *fn = NULL;
|
||||
|
||||
if (!(f = fopen(filename, "r"))) {
|
||||
pa_log(__FILE__": failed to open file '%s': %s\n", filename, strerror(errno));
|
||||
f = filename ?
|
||||
fopen(fn = pa_xstrdup(filename), "r") :
|
||||
pa_open_config_file(DEFAULT_MATCH_TABLE_FILE, DEFAULT_MATCH_TABLE_FILE_USER, NULL, &fn);
|
||||
|
||||
if (!f) {
|
||||
pa_log(__FILE__": failed to open file '%s': %s\n", fn, strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -135,6 +147,9 @@ finish:
|
|||
if (f)
|
||||
fclose(f);
|
||||
|
||||
if (fn)
|
||||
pa_xfree(fn);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue