mirror of https://github.com/aria2/aria2
Get the home directory of the effective user ID using getpwuid() if
$HOME is not defined.pull/16/merge
parent
25ef6677e9
commit
e4e9562c92
|
@ -35,6 +35,8 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -1008,7 +1010,12 @@ std::string getHomeDir()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#else // !__MINGW32__
|
||||||
|
passwd* pw = getpwuid(geteuid());
|
||||||
|
if(pw && pw->pw_dir) {
|
||||||
|
return pw->pw_dir;
|
||||||
|
}
|
||||||
|
#endif // !__MINGW32__
|
||||||
return A2STR::NIL;
|
return A2STR::NIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue