Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
e6511e80
Commit
e6511e80
authored
Mar 04, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Linux: fix set_libvlc_path and enable it
parent
674ae38b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
20 deletions
+30
-20
src/misc/linux_specific.c
src/misc/linux_specific.c
+30
-20
No files found.
src/misc/linux_specific.c
View file @
e6511e80
...
@@ -28,23 +28,14 @@
...
@@ -28,23 +28,14 @@
#include <vlc_common.h>
#include <vlc_common.h>
#include "../libvlc.h"
#include "../libvlc.h"
#if 0
static
const
char
default_path
[]
=
PKGLIBDIR
;
#include <assert.h>
#include <pthread.h>
#include <limits.h>
static
void
set_libvlc_path
(
void
)
static
void
set_libvlc_path
(
void
)
{
{
static char libvlc_path[PATH_MAX];
assert (strlen (LIBDIR) < sizeof (libvlc_path));
strcpy (libvlc_path, LIBDIR); /* fail safe */
psz_vlcpath = libvlc_path;
/* Find the path to libvlc (i.e. ourselves) */
/* Find the path to libvlc (i.e. ourselves) */
FILE
*
maps
=
fopen
(
"/proc/self/maps"
,
"rt"
);
FILE
*
maps
=
fopen
(
"/proc/self/maps"
,
"rt"
);
if
(
maps
==
NULL
)
if
(
maps
==
NULL
)
return
;
goto
error
;
char
*
line
=
NULL
;
char
*
line
=
NULL
;
size_t
linelen
=
0
;
size_t
linelen
=
0
;
...
@@ -68,15 +59,29 @@ static void set_libvlc_path (void)
...
@@ -68,15 +59,29 @@ static void set_libvlc_path (void)
if
(
end
==
NULL
)
if
(
end
==
NULL
)
continue
;
continue
;
*
file
=
'\0'
;
*
file
=
'\0'
;
printf ("libvlc at %s\n", dir);
if
(
asprintf
(
&
psz_vlcpath
,
"%s/"
PACKAGE
,
dir
)
==
-
1
)
if (strlen (dir) < sizeof (libvlc_path))
goto
error
;
strcpy (libvlc_path, dir);
break
;
break
;
}
}
free
(
line
);
free
(
line
);
fclose
(
maps
);
fclose
(
maps
);
return
;
error:
psz_vlcpath
=
(
char
*
)
default_path
;
/* default, cannot fail */
}
static
void
unset_libvlc_path
(
void
)
{
if
(
psz_vlcpath
!=
default_path
)
free
(
psz_vlcpath
);
}
}
#endif
static
struct
{
vlc_mutex_t
lock
;
unsigned
refs
;
}
once
=
{
VLC_STATIC_MUTEX
,
0
};
#ifdef __GLIBC__
#ifdef __GLIBC__
# include <gnu/libc-version.h>
# include <gnu/libc-version.h>
...
@@ -102,10 +107,11 @@ void system_Init (libvlc_int_t *libvlc, int *argc, const char *argv[])
...
@@ -102,10 +107,11 @@ void system_Init (libvlc_int_t *libvlc, int *argc, const char *argv[])
}
}
#endif
#endif
#if 0
vlc_mutex_lock
(
&
once
.
lock
);
static pthread_once_t once = PTHREAD_ONCE_INIT;
if
(
once
.
refs
++
==
0
)
pthread_once (&once, set_libvlc_path);
set_libvlc_path
();
#endif
vlc_mutex_unlock
(
&
once
.
lock
);
(
void
)
libvlc
;
(
void
)
argc
;
(
void
)
argv
;
(
void
)
libvlc
;
(
void
)
argc
;
(
void
)
argv
;
}
}
...
@@ -116,6 +122,10 @@ void system_Configure (libvlc_int_t *libvlc, int *argc, const char *argv[])
...
@@ -116,6 +122,10 @@ void system_Configure (libvlc_int_t *libvlc, int *argc, const char *argv[])
void
system_End
(
libvlc_int_t
*
libvlc
)
void
system_End
(
libvlc_int_t
*
libvlc
)
{
{
vlc_mutex_lock
(
&
once
.
lock
);
if
(
--
once
.
refs
==
0
)
unset_libvlc_path
();
vlc_mutex_unlock
(
&
once
.
lock
);
(
void
)
libvlc
;
(
void
)
libvlc
;
}
}
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