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. */
| 46 | * set both the POSIX and BS2000 user id's to the unprivileged user. |
| 47 | */ |
| 48 | static bs2_ForkType os_forktype(int one_process) |
| 49 | { |
| 50 | /* have we checked the OS version before? If yes return the previous |
| 51 | * result - the OS release isn't going to change suddenly! |
| 52 | */ |
| 53 | if (forktype == bs2_unknown) { |
| 54 | /* not initialized yet */ |
| 55 | |
| 56 | /* No fork if the one_process option was set */ |
| 57 | if (one_process) { |
| 58 | forktype = bs2_noFORK; |
| 59 | } |
| 60 | /* If the user is unprivileged, use the normal fork() only. */ |
| 61 | else if (getuid() != 0) { |
| 62 | forktype = bs2_FORK; |
| 63 | } |
| 64 | else |
| 65 | forktype = bs2_UFORK; |
| 66 | } |
| 67 | return forktype; |
| 68 | } |
| 69 | |
| 70 | |
| 71 |
no outgoing calls
no test coverage detected