Changeset 7507 for trunk/daemon/daemon.c
- Timestamp:
- Dec 26, 2008, 1:36:32 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/daemon.c
r7503 r7507 82 82 } 83 83 84 #if defined(WIN32) 85 #define USE_NO_DAEMON 86 #elif !defined(HAVE_DAEMON) || defined(__MIPSEL__) 87 #define USE_TR_DAEMON 88 #else 89 #define USE_OS_DAEMON 90 #endif 91 84 92 static int 85 93 tr_daemon( int nochdir, int noclose ) 86 94 { 87 #if defined( HAVE_DAEMON) && !defined(WIN32)95 #if defined(USE_OS_DAEMON) 88 96 return daemon( nochdir, noclose ); 89 #el se97 #elif defined(USE_TR_DAEMON) 90 98 pid_t pid = fork( ); 91 99 if( pid < 0 ) … … 126 134 } 127 135 } 136 #else /* USE_NO_DAEMON */ 137 return 0; 128 138 #endif 129 139 } … … 218 228 } 219 229 220 #ifndef WIN32 221 if( !foreground ) 230 if( !foreground && tr_daemon( TRUE, FALSE ) < 0 ) 222 231 { 223 if( 0 > tr_daemon( TRUE, FALSE ) ) 224 { 225 fprintf( stderr, "failed to daemonize: %s\n", strerror( errno ) ); 226 exit( 1 ); 227 } 228 } 229 #endif 232 fprintf( stderr, "failed to daemonize: %s\n", strerror( errno ) ); 233 exit( 1 ); 234 } 230 235 231 236 /* start the session */
Note: See TracChangeset
for help on using the changeset viewer.