From: Jaroslav Kysela <perex@perex.cz>
To: Takashi Iwai <tiwai@suse.de>,
ALSA development <alsa-devel@alsa-project.org>
Subject: Re: Anyone using alsactl preinit / postinit scripts?
Date: Thu, 14 Jun 2012 15:07:40 +0200 [thread overview]
Message-ID: <4FD9E21C.9030002@perex.cz> (raw)
In-Reply-To: <s5hd352p00j.wl%tiwai@suse.de>
Date 14.6.2012 14:10, Takashi Iwai wrote:
> Hi,
>
> is anyone already using preinit / postinit scripts of alsactl init?
> I'm thinking of appliny the patch below, but before that, I'd like to
> make sure that *.conf is the appropriate extension.
Hi,
This filename filter looks good to me. I have no objections to use the
.conf extension.
While improving this code, adding a filename sort might be also useful ;-)
> ---
> From: Takashi Iwai <tiwai@suse.de>
> Subject: [PATCH] alsactl: Read only *.conf files when a directory is passed via INCLUDE
>
> When alsactl init is invoked and a directory path is passed to INCLUDE
> command in the config file, read only *.conf files in that directory.
> This will avoid reading backup files or invalid files that have been
> created accidentally.
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> alsactl/init_parse.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c
> index 51b515c..83d12ba 100644
> --- a/alsactl/init_parse.c
> +++ b/alsactl/init_parse.c
> @@ -1502,12 +1502,16 @@ static int parse_line(struct space *space, char *line, size_t linesize)
> if (dir) {
> count = strlen(string);
> while ((dirent = readdir(dir)) != NULL) {
> - if (strcmp(dirent->d_name, ".") == 0 ||
> - strcmp(dirent->d_name, "..") == 0)
> + const char *name = dirent->d_name;
> + const char *ext;
> + if (*name == '.')
> + continue;
> + ext = strrchr(name, ',');
'.' should be matched here...
> + if (!ext || strcmp(ext, ".conf"))
> continue;
Please, update also the documentation in alsactl_init.xml .
Thanks,
Jaroslav
--
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
next prev parent reply other threads:[~2012-06-14 13:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-14 12:10 Anyone using alsactl preinit / postinit scripts? Takashi Iwai
2012-06-14 13:07 ` Jaroslav Kysela [this message]
2012-06-14 14:07 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FD9E21C.9030002@perex.cz \
--to=perex@perex.cz \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.