Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Icecast-Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
94
Issues
94
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
Icecast-Server
Commits
2accfe55
Commit
2accfe55
authored
Feb 17, 2004
by
Karl Heyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix possible bad pointer reference when finding fallback mount
svn path=/trunk/icecast/; revision=5830
parent
012b3f42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
35 deletions
+36
-35
src/source.c
src/source.c
+36
-35
No files found.
src/source.c
View file @
2accfe55
...
...
@@ -145,55 +145,56 @@ source_t *source_find_mount_raw(const char *mount)
return
NULL
;
}
static
source_t
*
source_find_mount_recursive
(
const
char
*
mount
,
int
depth
)
/* Search for mount, if the mount is there but not currently running then
* check it's fallback, and so on. Must have a global source lock to call
* this function.
*/
source_t
*
source_find_mount
(
const
char
*
mount
)
{
source_t
*
source
=
source_find_mount_raw
(
mount
);
mount_proxy
*
mountinfo
;
source_t
*
source
=
NULL
;
ice_config_t
*
config
;
char
*
fallback_mount
;
if
(
source
==
NULL
)
{
if
(
depth
>
MAX_FALLBACK_DEPTH
)
return
NULL
;
mount_proxy
*
mountinfo
;
int
depth
=
0
;
/* Look for defined mounts to find a fallback source */
config
=
config_get_config
();
while
(
mount
!=
NULL
)
{
/* limit the number of times through, maybe infinite */
if
(
depth
>
MAX_FALLBACK_DEPTH
)
{
source
=
NULL
;
break
;
}
config
=
config_get_config
();
mountinfo
=
config
->
mounts
;
thread_mutex_lock
(
&
(
config_locks
()
->
mounts_lock
));
config_release_config
();
source
=
source_find_mount_raw
(
mount
);
if
(
source
==
NULL
)
break
;
/* fallback to missing mountpoint */
while
(
mountinfo
)
{
if
(
!
strcmp
(
mountinfo
->
mountname
,
mount
))
if
(
source
->
running
)
break
;
/* source is not running, meaning that the fallback is not configured
within the source, we need to check the mount list */
mountinfo
=
config
->
mounts
;
source
=
NULL
;
while
(
mountinfo
)
{
if
(
strcmp
(
mountinfo
->
mountname
,
mount
)
==
0
)
break
;
mountinfo
=
mountinfo
->
next
;
}
if
(
mountinfo
)
fallback_mount
=
mountinfo
->
fallback_mount
;
if
(
mountinfo
)
mount
=
mountinfo
->
fallback_mount
;
else
fallback_mount
=
NULL
;
thread_mutex_unlock
(
&
(
config_locks
()
->
mounts_lock
));
if
(
fallback_mount
!=
NULL
)
{
return
source_find_mount_recursive
(
fallback_mount
,
depth
+
1
);
}
mount
=
NULL
;
depth
++
;
}
config_release_config
();
return
source
;
}
/* you must already have a read lock on the global source tree
** to call this function
*/
source_t
*
source_find_mount
(
const
char
*
mount
)
{
if
(
!
mount
)
return
NULL
;
return
source_find_mount_recursive
(
mount
,
0
);
}
int
source_compare_sources
(
void
*
arg
,
void
*
a
,
void
*
b
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment