mirror of
https://github.com/aria2/aria2.git
synced 2025-01-04 00:53:19 +00:00
Check availability of pwd.h
This commit is contained in:
parent
c7c26e67c4
commit
840ca5adb6
@ -317,7 +317,8 @@ AC_CHECK_HEADERS([argz.h \
|
|||||||
unistd.h \
|
unistd.h \
|
||||||
utime.h \
|
utime.h \
|
||||||
wchar.h \
|
wchar.h \
|
||||||
ifaddrs.h])
|
ifaddrs.h \
|
||||||
|
pwd.h])
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_HEADER_STDBOOL
|
AC_HEADER_STDBOOL
|
||||||
|
@ -36,7 +36,9 @@
|
|||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <pwd.h>
|
#ifdef HAVE_PWD_H
|
||||||
|
# include <pwd.h>
|
||||||
|
#endif // HAVE_PWD_H
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -1026,12 +1028,12 @@ std::string getHomeDir()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // !__MINGW32__
|
#elif HAVE_PWD_H
|
||||||
passwd* pw = getpwuid(geteuid());
|
passwd* pw = getpwuid(geteuid());
|
||||||
if(pw && pw->pw_dir) {
|
if(pw && pw->pw_dir) {
|
||||||
return pw->pw_dir;
|
return pw->pw_dir;
|
||||||
}
|
}
|
||||||
#endif // !__MINGW32__
|
#endif // HAVE_PWD_H
|
||||||
return A2STR::NIL;
|
return A2STR::NIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user