VirtualBox

Changeset 4100 in vbox


Ignore:
Timestamp:
Aug 9, 2007 5:13:24 PM (17 years ago)
Author:
vboxsync
Message:

Hopefully fix problem with controlling tty (xtracker defect #2166). Just
clearing it doesn't work, as we might automatically be attached to
another controlling tty if we're a session leader. So fork again. See
source of daemon() function in some libc versions (not POSIX).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/linux/server.cpp

    r4071 r4100  
    991991
    992992    /* nothing to do here, the process is supposed to be already
    993      * started daemonized when it is necessary */ 
     993     * started daemonized when it is necessary */
    994994    NOREF(fDaemonize);
    995995
     
    10471047            printf("ERROR: setsid() failed (errno = %d)\n", errno);
    10481048            return 1;
     1049        }
     1050
     1051        /* Need to do another for to get rid of the session leader status.
     1052         * Otherwise any accidentally opened tty will automatically become a
     1053         * controlling tty for the daemon process. */
     1054        childpid = fork();
     1055        if (childpid == -1)
     1056        {
     1057            printf("ERROR: second fork() failed (errno = %d)\n", errno);
     1058            return 1;
     1059        }
     1060
     1061        if (childpid != 0)
     1062        {
     1063            /* we're the parent process, just a dummy so terminate now */
     1064            exit(0);
    10491065        }
    10501066
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette