MCPcopy Create free account
hub / github.com/apache/httpd / os_fork

Function os_fork

os/bs2000/os.c:98–130  ·  view source on GitHub ↗

BS2000 requires a "special" version of fork() before a setuid() call */

Source from the content-addressed store, hash-verified

96
97/* BS2000 requires a "special" version of fork() before a setuid() call */
98pid_t os_fork(const char *user)
99{
100 pid_t pid;
101 char username[USER_LEN+1];
102
103 switch (os_forktype(0)) {
104
105 case bs2_FORK:
106 pid = fork();
107 break;
108
109 case bs2_UFORK:
110 apr_cpystrn(username, user, sizeof username);
111
112 /* Make user name all upper case - for some versions of ufork() */
113 ap_str_toupper(username);
114
115 pid = ufork(username);
116 if (pid == -1 && errno == EPERM) {
117 ap_log_error(APLOG_MARK, APLOG_EMERG, errno, ap_server_conf,
118 APLOGNO(02171) "ufork: Possible mis-configuration "
119 "for user %s - Aborting.", user);
120 exit(1);
121 }
122 break;
123
124 default:
125 pid = 0;
126 break;
127 }
128
129 return pid;
130}
131
132#else /* _OSD_POSIX */
133void bs2000_os_is_not_here()

Callers 1

prefork.cFile · 0.50

Calls 3

ap_str_toupperFunction · 0.85
os_forktypeFunction · 0.70
ap_log_errorFunction · 0.50

Tested by

no test coverage detected