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

Function os_fork

os/unix/unixd.c:698–730  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

696
697/* BS2000 requires a "special" version of fork() before a setuid() call */
698pid_t os_fork(const char *user)
699{
700 pid_t pid;
701 char username[USER_LEN+1];
702
703 switch (os_forktype(0)) {
704
705 case bs2_FORK:
706 pid = fork();
707 break;
708
709 case bs2_UFORK:
710 apr_cpystrn(username, user, sizeof username);
711
712 /* Make user name all upper case - for some versions of ufork() */
713 ap_str_toupper(username);
714
715 pid = ufork(username);
716 if (pid == -1 && errno == EPERM) {
717 ap_log_error(APLOG_MARK, APLOG_EMERG, errno, ap_server_conf,
718 APLOGNO(02181) "ufork: Possible mis-configuration "
719 "for user %s - Aborting.", user);
720 exit(1);
721 }
722 break;
723
724 default:
725 pid = 0;
726 break;
727 }
728
729 return pid;
730}
731
732#endif /* _OSD_POSIX */
733

Callers

nothing calls this directly

Calls 3

ap_str_toupperFunction · 0.85
os_forktypeFunction · 0.70
ap_log_errorFunction · 0.50

Tested by

no test coverage detected