[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] cli-command: Replace config dir with toplevel for .include on win32
PulseAudio Marge Bot (@pulseaudio-merge-bot)
gitlab at gitlab.freedesktop.org
Mon May 3 11:01:56 UTC 2021
PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio
Commits:
a238a581 by Patrick Gaskin at 2021-05-03T10:58:45+00:00
cli-command: Replace config dir with toplevel for .include on win32
This makes the behaviour match pa_{open,find}_config_file by
replacing PA_DEFAULT_CONFIG_DIR with the toplevel.
This fixes the hardcoded paths for {default,system}.pa.d introduced
in 45abd0b43c7901b375afcba6d9b0e1cca2f349a8 (!361).
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/545>
- - - - -
1 changed file:
- src/pulsecore/cli-command.c
Changes:
=====================================
src/pulsecore/cli-command.c
=====================================
@@ -2084,20 +2084,34 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b
if (l == sizeof(META_INCLUDE)-1 && !strncmp(cs, META_INCLUDE, l)) {
struct stat st;
- const char *filename = cs+l+strspn(cs+l, whitespace);
+ const char *fn = cs+l+strspn(cs+l, whitespace);
+
+ char *filename;
+#ifdef OS_IS_WIN32
+ if (strncmp(fn, PA_DEFAULT_CONFIG_DIR, strlen(PA_DEFAULT_CONFIG_DIR)) == 0)
+ filename = pa_sprintf_malloc("%s" PA_PATH_SEP "etc" PA_PATH_SEP "pulse" PA_PATH_SEP "%s",
+ pa_win32_get_toplevel(NULL),
+ fn + strlen(PA_DEFAULT_CONFIG_DIR));
+ else
+#endif
+ filename = pa_xstrdup(fn);
if (stat(filename, &st) < 0) {
pa_log_warn("stat('%s'): %s", filename, pa_cstrerror(errno));
- if (*fail)
+ if (*fail) {
+ pa_xfree(filename);
return -1;
+ }
} else {
if (S_ISDIR(st.st_mode)) {
DIR *d;
if (!(d = opendir(filename))) {
pa_log_warn("Failed to read '%s': %s", filename, pa_cstrerror(errno));
- if (*fail)
+ if (*fail) {
+ pa_xfree(filename);
return -1;
+ }
} else {
unsigned i, count;
char **sorted_files;
@@ -2143,14 +2157,18 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b
pa_xfree(sorted_files[i]);
}
pa_xfree(sorted_files);
- if (failed)
+ if (failed) {
+ pa_xfree(filename);
return -1;
+ }
}
}
} else if (pa_cli_command_execute_file(c, filename, buf, fail) < 0 && *fail) {
+ pa_xfree(filename);
return -1;
}
}
+ pa_xfree(filename);
} else if (l == sizeof(META_IFEXISTS)-1 && !strncmp(cs, META_IFEXISTS, l)) {
if (!ifstate) {
pa_strbuf_printf(buf, "Meta command %s is not valid in this context\n", cs);
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/a238a58186ed7f68676d8ef17285a962bd013361
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/a238a58186ed7f68676d8ef17285a962bd013361
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20210503/1fa7513a/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list