Avoid getpwuid for static linking
This commit is contained in:
1 parent
f0306405c1
commit
f1c49473a3
1 file changed
-7
@@ -28,9 +28,6 @@ extern "C"
|
|||||||
void *alloca (size_t);
|
void *alloca (size_t);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef WIN32
|
|
||||||
#include <pwd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -103,10 +100,6 @@ jv get_home() {
|
|||||||
char *home = getenv("HOME");
|
char *home = getenv("HOME");
|
||||||
if (!home) {
|
if (!home) {
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
struct passwd* pwd = getpwuid(getuid());
|
|
||||||
if (pwd)
|
|
||||||
ret = jv_string(pwd->pw_dir);
|
|
||||||
else
|
|
||||||
ret = jv_invalid_with_msg(jv_string("Could not find home directory."));
|
ret = jv_invalid_with_msg(jv_string("Could not find home directory."));
|
||||||
#else
|
#else
|
||||||
home = getenv("USERPROFILE");
|
home = getenv("USERPROFILE");
|
||||||
|
|||||||
Reference in new issue
Block a user