Changeset 513


Ignore:
Timestamp:
09/17/09 14:55:32 (3 years ago)
Author:
eagle
Message:

OC should now detach properly from console

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure

    r512 r513  
    11#! /bin/sh 
    22# Guess values for system-dependent variables and create Makefiles. 
    3 # Generated by GNU Autoconf 2.62 for onioncat 0.2.0.r512. 
     3# Generated by GNU Autoconf 2.62 for onioncat 0.2.0.r513. 
    44# 
    55# Report bugs to <rahra@cypherpunk.at>. 
     
    597597PACKAGE_NAME='onioncat' 
    598598PACKAGE_TARNAME='onioncat' 
    599 PACKAGE_VERSION='0.2.0.r512' 
    600 PACKAGE_STRING='onioncat 0.2.0.r512' 
     599PACKAGE_VERSION='0.2.0.r513' 
     600PACKAGE_STRING='onioncat 0.2.0.r513' 
    601601PACKAGE_BUGREPORT='rahra@cypherpunk.at' 
    602602 
     
    12601260  # This message is too long to be a string in the A/UX 3.1 sh. 
    12611261  cat <<_ACEOF 
    1262 \`configure' configures onioncat 0.2.0.r512 to adapt to many kinds of systems. 
     1262\`configure' configures onioncat 0.2.0.r513 to adapt to many kinds of systems. 
    12631263 
    12641264Usage: $0 [OPTION]... [VAR=VALUE]... 
     
    13301330if test -n "$ac_init_help"; then 
    13311331  case $ac_init_help in 
    1332      short | recursive ) echo "Configuration of onioncat 0.2.0.r512:";; 
     1332     short | recursive ) echo "Configuration of onioncat 0.2.0.r513:";; 
    13331333   esac 
    13341334  cat <<\_ACEOF 
     
    14221422if $ac_init_version; then 
    14231423  cat <<\_ACEOF 
    1424 onioncat configure 0.2.0.r512 
     1424onioncat configure 0.2.0.r513 
    14251425generated by GNU Autoconf 2.62 
    14261426 
     
    14361436running configure, to aid debugging if configure makes a mistake. 
    14371437 
    1438 It was created by onioncat $as_me 0.2.0.r512, which was 
     1438It was created by onioncat $as_me 0.2.0.r513, which was 
    14391439generated by GNU Autoconf 2.62.  Invocation command line was 
    14401440 
     
    20852085# Define the identity of the package. 
    20862086 PACKAGE='onioncat' 
    2087  VERSION='0.2.0.r512' 
     2087 VERSION='0.2.0.r513' 
    20882088 
    20892089 
     
    22362236 
    22372237cat >>confdefs.h <<\_ACEOF 
    2238 #define SVN_REVISION "512" 
     2238#define SVN_REVISION "513" 
    22392239_ACEOF 
    22402240 
     
    52095209# values after options handling. 
    52105210ac_log=" 
    5211 This file was extended by onioncat $as_me 0.2.0.r512, which was 
     5211This file was extended by onioncat $as_me 0.2.0.r513, which was 
    52125212generated by GNU Autoconf 2.62.  Invocation command line was 
    52135213 
     
    52625262cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 
    52635263ac_cs_version="\\ 
    5264 onioncat config.status 0.2.0.r512 
     5264onioncat config.status 0.2.0.r513 
    52655265configured by $0, generated by GNU Autoconf 2.62, 
    52665266  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" 
  • trunk/src/ocat.c

    r511 r513  
    126126      case 0: 
    127127         log_msg(LOG_INFO, "process backgrounded by parent %d, new pid = %d", ppid, getpid()); 
     128         (void) umask(0); 
     129         if (setsid() == -1) 
     130            log_msg(LOG_ERR, "could not set process group ID: \"%s\"", strerror(errno)); 
     131         if (chdir("/") == -1) 
     132            log_msg(LOG_ERR, "could not change directory to /: \"%s\"", strerror(errno)); 
     133         // redirect standard files to /dev/null 
     134         if (!freopen( "/dev/null", "r", stdin)) 
     135            log_msg(LOG_ERR, "could not reconnect stdin to /dev/null: \"%s\"", strerror(errno)); 
     136         if (!freopen( "/dev/null", "w", stdout)) 
     137            log_msg(LOG_ERR, "could not reconnect stdout to /dev/null: \"%s\"", strerror(errno)); 
     138         if (!freopen( "/dev/null", "w", stderr)) 
     139            log_msg(LOG_ERR, "could not reconnect stderr to /dev/null: \"%s\"", strerror(errno)); 
    128140         return; 
    129141 
     
    224236   struct passwd *pwd, pwdm; 
    225237   int urlconv = 0; 
    226    int nullfd; 
    227238 
    228239   snprintf(def, 100, "127.0.0.1:%d", OCAT_LISTEN_PORT); 
     
    467478      open_connect_log(pwd->pw_dir); 
    468479 
    469    // reconnect stdio if logfile ok and daemonized 
    470    if (CNF(daemon)) 
    471    { 
    472       if ((nullfd = open("/dev/null", O_RDWR)) != -1) 
    473       { 
    474          oe_close(0); 
    475          dup(nullfd); 
    476          oe_close(1); 
    477          dup(nullfd); 
    478          oe_close(2); 
    479          dup(nullfd); 
    480       } 
    481       else 
    482          log_msg(LOG_ERR, "could not reconnect stdio to /dev/null: \"%s\"", strerror(errno)); 
    483    } 
    484  
    485480   // create socks connector thread and communication queue 
    486481   if (pipe(CNF(socksfd)) == -1) 
Note: See TracChangeset for help on using the changeset viewer.