|
|
@ -26,10 +26,8 @@ |
|
|
|
#include <libgen.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <unistd.h> |
|
|
|
#if defined(__APPLE__) |
|
|
|
#include <stdlib.h> |
|
|
|
#include <pwd.h> |
|
|
|
#endif |
|
|
|
|
|
|
|
FILE* ethash_fopen(char const* file_name, char const* mode) |
|
|
|
{ |
|
|
@ -93,14 +91,12 @@ bool ethash_get_default_dirname(char* strbuf, size_t buffsize) |
|
|
|
static const char dir_suffix[] = ".ethash/"; |
|
|
|
strbuf[0] = '\0'; |
|
|
|
char* home_dir = getenv("HOME"); |
|
|
|
#if defined(__APPLE__) |
|
|
|
if (!home_dir || strlen(home_dir) == 0) |
|
|
|
{ |
|
|
|
struct passwd* pwd = getpwuid(getuid()); |
|
|
|
if (pwd) |
|
|
|
home_dir = pwd->pw_dir; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
size_t len = strlen(home_dir); |
|
|
|
if (!ethash_strncat(strbuf, buffsize, home_dir, len)) { |
|
|
|