Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
e7125f4e
Commit
e7125f4e
authored
May 05, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use getpwuid_r - thread safety
parent
04a4af73
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
23 deletions
+16
-23
configure.ac
configure.ac
+1
-1
src/config/core.c
src/config/core.c
+15
-22
No files found.
configure.ac
View file @
e7125f4e
...
...
@@ -464,7 +464,7 @@ dnl Check for system libs needed
need_libc=false
dnl Check for usual libc functions
AC_CHECK_FUNCS([gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat strlcpy strdup strndup strnlen atof lldiv posix_fadvise posix_madvise])
AC_CHECK_FUNCS([gettimeofday strtod strtol strtof strtoll strtoull strsep isatty vasprintf asprintf swab sigrelse getpwuid
_r
memalign posix_memalign if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon scandir fork bsearch lstat strlcpy strdup strndup strnlen atof lldiv posix_fadvise posix_madvise])
AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])
...
...
src/config/core.c
View file @
e7125f4e
...
...
@@ -39,8 +39,8 @@
# include <unistd.h>
/* getuid() */
#endif
#if defined(HAVE_GETPWUID)
# include <pwd.h>
/* getpwuid() */
#if defined(HAVE_GETPWUID
_R
)
# include <pwd.h>
#endif
#if defined( HAVE_SYS_STAT_H )
...
...
@@ -617,13 +617,6 @@ const char *config_GetDataDir( void )
#endif
}
/*****************************************************************************
* config_GetHomeDir, config_GetUserDir: find the user's home directory.
*****************************************************************************
* This function will try by different ways to find the user's home path.
* Note that this function is not reentrant, it should be called only once
* at the beginning of main where the result will be stored for later use.
*****************************************************************************/
static
char
*
GetDir
(
bool
b_appdata
)
{
const
char
*
psz_localhome
=
NULL
;
...
...
@@ -671,7 +664,7 @@ static char *GetDir( bool b_appdata )
}
#elif defined(UNDER_CE)
(
void
)
b_appdata
;
#ifndef CSIDL_APPDATA
# define CSIDL_APPDATA 0x1A
#endif
...
...
@@ -681,25 +674,25 @@ static char *GetDir( bool b_appdata )
/* get the "Application Data" folder for the current user */
if
(
SHGetSpecialFolderPath
(
NULL
,
whomedir
,
CSIDL_APPDATA
,
1
)
)
return
FromWide
(
whomedir
);
#else
(
void
)
b_appdata
;
#endif
psz_localhome
=
getenv
(
"HOME"
);
#if defined(HAVE_GETPWUID_R)
char
buf
[
sysconf
(
_SC_GETPW_R_SIZE_MAX
)];
if
(
psz_localhome
==
NULL
)
{
#if defined(HAVE_GETPWUID)
struct
passwd
*
p_pw
;
(
void
)
b_appdata
;
struct
passwd
pw
,
*
res
;
if
(
(
p_pw
=
getpwuid
(
getuid
()
)
)
!=
NULL
)
psz_localhome
=
p
_pw
->
pw_dir
;
else
if
(
!
getpwuid_r
(
getuid
(),
&
pw
,
buf
,
sizeof
(
buf
),
&
res
)
&&
res
)
psz_localhome
=
p
w
.
pw_dir
;
}
#endif
{
if
(
psz_localhome
==
NULL
)
psz_localhome
=
getenv
(
"TMP"
);
if
(
psz_localhome
==
NULL
)
if
(
psz_localhome
==
NULL
)
psz_localhome
=
"/tmp"
;
}
}
return
FromLocaleDup
(
psz_localhome
);
}
...
...
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