Compare commits

..

No commits in common. "702cc0442c1e1df7831d4292c4e42282875322e6" and "91470851cd07e1d795d411a3baa98c2d2c7a7242" have entirely different histories.

2 changed files with 3 additions and 13 deletions

View File

@ -7,7 +7,7 @@
extern int kernel_start; extern int kernel_start;
extern int kernel_end; extern int kernel_end;
static InitRD::File symbol_map = {"", 0, 0, (void*)-1, 0}; static InitRD::File symbol_map = {"", 0, 0, (void*)-1};
static size_t symbol_strlen(const char* symbol) static size_t symbol_strlen(const char* symbol)
{ {

View File

@ -7,8 +7,6 @@
#include <unistd.h> #include <unistd.h>
static FILE* pwd_file = nullptr; static FILE* pwd_file = nullptr;
static FILE* pwnam_file = nullptr;
static FILE* pwuid_file = nullptr;
static int initialize_pwd(FILE** stream) static int initialize_pwd(FILE** stream)
{ {
@ -128,6 +126,7 @@ extern "C"
struct passwd* getpwnam(const char* name) struct passwd* getpwnam(const char* name)
{ {
static FILE* pwnam_file = nullptr;
if (!pwnam_file) if (!pwnam_file)
{ {
if (!initialize_pwd(&pwnam_file)) return NULL; if (!initialize_pwd(&pwnam_file)) return NULL;
@ -150,6 +149,7 @@ extern "C"
struct passwd* getpwuid(uid_t uid) struct passwd* getpwuid(uid_t uid)
{ {
static FILE* pwuid_file = nullptr;
if (!pwuid_file) if (!pwuid_file)
{ {
if (!initialize_pwd(&pwuid_file)) return NULL; if (!initialize_pwd(&pwuid_file)) return NULL;
@ -182,15 +182,5 @@ extern "C"
fclose(pwd_file); fclose(pwd_file);
pwd_file = nullptr; pwd_file = nullptr;
} }
if (pwuid_file)
{
fclose(pwuid_file);
pwuid_file = nullptr;
}
if (pwnam_file)
{
fclose(pwnam_file);
pwnam_file = nullptr;
}
} }
} }