Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
2f2b394d
Commit
2f2b394d
authored
Oct 26, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/StandardDirectory: no /etc/passwd lookups on Android
This doesn't make sense on Android; there is no home directory for users.
parent
ba181ae9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
StandardDirectory.cxx
src/fs/StandardDirectory.cxx
+9
-1
No files found.
src/fs/StandardDirectory.cxx
View file @
2f2b394d
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
#include "Main.hxx"
#include "Main.hxx"
#endif
#endif
#if
ndef WIN32
#if
!defined(WIN32) && !defined(ANDROID)
class
PasswdEntry
class
PasswdEntry
{
{
#if defined(HAVE_GETPWNAM_R) || defined(HAVE_GETPWUID_R)
#if defined(HAVE_GETPWNAM_R) || defined(HAVE_GETPWUID_R)
...
@@ -91,6 +91,7 @@ public:
...
@@ -91,6 +91,7 @@ public:
};
};
#endif
#endif
#ifndef ANDROID
static
inline
bool
static
inline
bool
IsValidPathString
(
PathTraitsFS
::
const_pointer_type
path
)
IsValidPathString
(
PathTraitsFS
::
const_pointer_type
path
)
{
{
...
@@ -111,6 +112,7 @@ SafePathFromFS(PathTraitsFS::const_pointer_type dir)
...
@@ -111,6 +112,7 @@ SafePathFromFS(PathTraitsFS::const_pointer_type dir)
return
AllocatedPath
::
FromFS
(
dir
);
return
AllocatedPath
::
FromFS
(
dir
);
return
AllocatedPath
::
Null
();
return
AllocatedPath
::
Null
();
}
}
#endif
#ifdef WIN32
#ifdef WIN32
static
AllocatedPath
GetStandardDir
(
int
folder_id
)
static
AllocatedPath
GetStandardDir
(
int
folder_id
)
...
@@ -310,21 +312,27 @@ AllocatedPath GetAppBaseDir()
...
@@ -310,21 +312,27 @@ AllocatedPath GetAppBaseDir()
AllocatedPath
GetHomeDir
()
AllocatedPath
GetHomeDir
()
{
{
#ifndef ANDROID
auto
home
=
getenv
(
"HOME"
);
auto
home
=
getenv
(
"HOME"
);
if
(
IsValidPathString
(
home
)
&&
IsValidDir
(
home
))
if
(
IsValidPathString
(
home
)
&&
IsValidDir
(
home
))
return
AllocatedPath
::
FromFS
(
home
);
return
AllocatedPath
::
FromFS
(
home
);
PasswdEntry
pw
;
PasswdEntry
pw
;
if
(
pw
.
ReadByUid
(
getuid
()))
if
(
pw
.
ReadByUid
(
getuid
()))
return
SafePathFromFS
(
pw
->
pw_dir
);
return
SafePathFromFS
(
pw
->
pw_dir
);
#endif
return
AllocatedPath
::
Null
();
return
AllocatedPath
::
Null
();
}
}
AllocatedPath
GetHomeDir
(
const
char
*
user_name
)
AllocatedPath
GetHomeDir
(
const
char
*
user_name
)
{
{
#ifdef ANDROID
(
void
)
user_name
;
#else
assert
(
user_name
!=
nullptr
);
assert
(
user_name
!=
nullptr
);
PasswdEntry
pw
;
PasswdEntry
pw
;
if
(
pw
.
ReadByName
(
user_name
))
if
(
pw
.
ReadByName
(
user_name
))
return
SafePathFromFS
(
pw
->
pw_dir
);
return
SafePathFromFS
(
pw
->
pw_dir
);
#endif
return
AllocatedPath
::
Null
();
return
AllocatedPath
::
Null
();
}
}
...
...
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