summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-02-20 13:40:36 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-02-20 13:40:36 +0100
commit93b11cab322a5543a5f748bc4f70246abe5dace6 (patch)
treec1f109416598e64623905cbe9086b4eb74715b41 /src/main.c
parent4e6dcf3e37e9aba48ab80f4db3606bcdb46d3032 (diff)
downloadratpoison-93b11cab322a5543a5f748bc4f70246abe5dace6.zip
Detect pwd.h and getpwuid.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index e5456c6..0593b64 100644
--- a/src/main.c
+++ b/src/main.c
@@ -35,7 +35,6 @@
#include <string.h>
#include <sys/wait.h>
#include <ctype.h>
-#include <pwd.h>
#include "ratpoison.h"
@@ -43,6 +42,10 @@
# include <langinfo.h>
#endif
+#if defined (HAVE_PWD_H) && defined (HAVE_GETPWUID)
+#include <pwd.h>
+#endif
+
/* Several systems seem not to have WAIT_ANY defined, so define it if
it isn't. */
#ifndef WAIT_ANY
@@ -422,6 +425,7 @@ read_startup_files (char *alt_rcfile)
$sysconfdir/ratpoisonrc */
homedir = getenv ("HOME");
+#if defined (HAVE_PWD_H) && defined (HAVE_GETPWUID)
if (!homedir)
{
struct passwd *pw;
@@ -430,6 +434,7 @@ read_startup_files (char *alt_rcfile)
if (pw)
homedir = pw->pw_dir;
}
+#endif
if (!homedir)
PRINT_ERROR (("ratpoison: no home directory!?\n"));