Browse Source

Only compile in daemon() if the target has an MMU.
-Erik

Eric Andersen 23 years ago
parent
commit
c4a3f3f81e
2 changed files with 6 additions and 6 deletions
  1. 4 1
      libc/unistd/Makefile
  2. 2 5
      libc/unistd/daemon.c

+ 4 - 1
libc/unistd/Makefile

@@ -26,7 +26,10 @@ LIBC=$(TOPDIR)libc.a
 DIRS:=
 
 CSRC=execl.c execlp.c execv.c execvep.c execvp.c execle.c getcwd.c getopt.c \
-	sleep.c getpass.c sysconf_src.c getopt_vars.c daemon.c getlogin.c fpathconf.c
+	sleep.c getpass.c sysconf_src.c getopt_vars.c getlogin.c fpathconf.c
+ifeq ($(strip $(HAS_MMU)),true)
+    CSRC+=daemon.c
+endif
 
 # TESTING -- comment this out if it breaks for you
 ifeq ($(TARGET_ARCH), $(NATIVE_ARCH))

+ 2 - 5
libc/unistd/daemon.c

@@ -32,10 +32,11 @@
 #include <paths.h>
 #include <unistd.h>
 
+/* Note that this file should not be compiled in 
+ * unless __UCLIBC_HAS_MMU__ is defined */
 
 int daemon( int nochdir, int noclose )
 {
-#if __UCLIBC_HAS_MMU__
     int fd;
 
     switch (fork()) {
@@ -61,10 +62,6 @@ int daemon( int nochdir, int noclose )
 	    close(fd);
     }
     return(0);
-#else
-	fprintf(stderr, "Sorry, daemon() requires an MMU\n");
-    return(-1);
-#endif	
 }