Skip to content
Myr

Avoid getpwuid for static linking

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by itchyny · committed by Nico Williams · parent f030640 · Browse files · 1 file+1 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−8 removed

  • other:+1 added−8 removed

1 file+1 added−8 removed

modified:src/util.c+1 added-8 removed
26 unmodified lines
27# endif28void *alloca (size_t);29# endif30#endif31#ifndef WIN3232#include <pwd.h>33#endif3132#ifdef WIN3233#include <windows.h>34#include <processenv.h>
64 unmodified lines
99 jv ret;100 char *home = getenv("HOME");101 if (!home) {102#ifndef WIN32106 struct passwd* pwd = getpwuid(getuid());107 if (pwd)108 ret = jv_string(pwd->pw_dir);109 else110 ret = jv_invalid_with_msg(jv_string("Could not find home directory."));103 ret = jv_invalid_with_msg(jv_string("Could not find home directory."));104#else105 home = getenv("USERPROFILE");106 if (!home) {107 char *hd = getenv("HOMEDRIVE");
342 unmodified lines