summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2013-12-12 07:26:13 -0800
committerKaz Kylheku <kaz@kylheku.com>2013-12-12 07:26:13 -0800
commit8e493b2eaf671e962a55e13c17bf42c51a3fd2bd (patch)
tree982c1453e38cfd8226ac3221983cecd863d22210
parent986d9c78daa61375d23e30ce2441925c27bc4482 (diff)
downloadtxr-8e493b2eaf671e962a55e13c17bf42c51a3fd2bd.tar.gz
txr-8e493b2eaf671e962a55e13c17bf42c51a3fd2bd.tar.bz2
txr-8e493b2eaf671e962a55e13c17bf42c51a3fd2bd.zip
* configure: Fix warnings in test cases for HAVE_FORK_STUFF
and HAVE_DAEMON. * eval.c: daemon support must be wrapped in #if HAVE_DAEMON
-rw-r--r--ChangeLog7
-rwxr-xr-xconfigure6
-rw-r--r--eval.c4
3 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 6b8c3d8d..cbe6ba62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-12-12 Kaz Kylheku <kaz@kylheku.com>
+
+ * configure: Fix warnings in test cases for HAVE_FORK_STUFF
+ and HAVE_DAEMON.
+
+ * eval.c: daemon support must be wrapped in #if HAVE_DAEMON
+
2013-12-11 Kaz Kylheku <kaz@kylheku.com>
* txr.c (txr_main): Change stderr to line buffered mode.
diff --git a/configure b/configure
index add43f30..52a24b5b 100755
--- a/configure
+++ b/configure
@@ -1235,9 +1235,10 @@ int main(int argc, char **argv)
{
int status, fd[2];
pid_t p = fork();
+ int res = pipe(fd);
(void) execvp(argv[0], argv);
(void) waitpid(p, &status, 0);
- (void) pipe(fd);
+ (void) res;
return 0;
}
!
@@ -1377,8 +1378,7 @@ cat > conftest.c <<!
int main(int argc, char **argv)
{
- daemon(0, 0);
- return 0;
+ return daemon(0, 0);
}
!
rm -f conftest
diff --git a/eval.c b/eval.c
index d3129126..cd40a888 100644
--- a/eval.c
+++ b/eval.c
@@ -2087,11 +2087,13 @@ static val errno_wrap(val newval)
return oldval;
}
+#if HAVE_DAEMON
static val daemon_wrap(val nochdir, val noclose)
{
int result = daemon(nochdir ? 1 : 0, noclose ? 1 : 0);
return result == 0 ? t : nil;
}
+#endif
static void reg_fun(val sym, val fun)
{
@@ -2589,7 +2591,9 @@ void eval_init(void)
reg_fun(intern(lit("make-time-utc"), user_package), func_n7(make_time_utc));
reg_fun(intern(lit("errno"), user_package), func_n1o(errno_wrap, 0));
+#if HAVE_DAEMON
reg_fun(intern(lit("daemon"), user_package), func_n2(daemon_wrap));
+#endif
#if HAVE_SYSLOG
reg_var(intern(lit("log-pid"), user_package), &log_pid_v);