Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:zhy20120210:3
alsa
alsa-lib-conf-prevent-dup-ids.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File alsa-lib-conf-prevent-dup-ids.diff of Package alsa
From e2317969e140b2c956db38583dcc0d7f3747670f Mon Sep 17 00:00:00 2001 From: Clemens Ladisch <clemens@ladisch.de> Date: Fri, 10 Jul 2009 07:25:50 +0200 Subject: [PATCH] conf.c: snd_config_set_id: prevent duplicate ids snd_config_add() checks for duplicate ids, but it was possible to create duplicates by adding a note and changing the id afterwards with snd_config_set_id(); so we have to add a check there, too. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> --- src/conf.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/conf.c b/src/conf.c index ff9d433..d1fa109 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1521,9 +1521,17 @@ int snd_config_get_id(const snd_config_t *config, const char **id) */ int snd_config_set_id(snd_config_t *config, const char *id) { + snd_config_iterator_t i, next; char *new_id; assert(config); if (id) { + if (config->father) { + snd_config_for_each(i, next, config->father) { + snd_config_t *n = snd_config_iterator_entry(i); + if (n != config && strcmp(id, n->id) == 0) + return -EEXIST; + } + } new_id = strdup(id); if (!new_id) return -ENOMEM; -- 1.6.6.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor