Determine the method for forking off a child in such a way as to * set both the POSIX and BS2000 user id's to the unprivileged user. */
| 646 | * set both the POSIX and BS2000 user id's to the unprivileged user. |
| 647 | */ |
| 648 | static bs2_ForkType os_forktype(int one_process) |
| 649 | { |
| 650 | /* have we checked the OS version before? If yes return the previous |
| 651 | * result - the OS release isn't going to change suddenly! |
| 652 | */ |
| 653 | if (forktype == bs2_unknown) { |
| 654 | /* not initialized yet */ |
| 655 | |
| 656 | /* No fork if the one_process option was set */ |
| 657 | if (one_process) { |
| 658 | forktype = bs2_noFORK; |
| 659 | } |
| 660 | /* If the user is unprivileged, use the normal fork() only. */ |
| 661 | else if (getuid() != 0) { |
| 662 | forktype = bs2_FORK; |
| 663 | } |
| 664 | else |
| 665 | forktype = bs2_UFORK; |
| 666 | } |
| 667 | return forktype; |
| 668 | } |
| 669 | |
| 670 | |
| 671 |
no outgoing calls
no test coverage detected