From: Cristiano Giuffrida Date: Wed, 23 Dec 2009 16:26:28 +0000 (+0000) Subject: Move setuid() hack where it belongs. X-Git-Tag: v3.1.6~135 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=f24f987b950d0eb70644a6b9edd46bc093c6faec;p=minix.git Move setuid() hack where it belongs. --- diff --git a/servers/rs/manager.c b/servers/rs/manager.c index 053d13777..3c8e31e43 100644 --- a/servers/rs/manager.c +++ b/servers/rs/manager.c @@ -1159,19 +1159,6 @@ endpoint_t *endpoint; init_pci(rp, child_proc_nr_e); } - /* The purpose of non-blocking forks is to avoid involving VFS in the forking - * process, because VFS may be blocked on a sendrec() to a MFS that is - * waiting for a endpoint update for a dead driver. We have just published - * that update, but VFS may still be blocked. As a result, VFS may not yet - * have received PM's fork message. Hence, if we call mapdriver5() - * immediately, VFS may not know about the process and thus refuse to add the - * driver entry. The following temporary hack works around this by forcing - * blocking communication from PM to VFS. Once VFS has been made non-blocking - * towards MFS instances, this hack and the entire fork_nb() call can go. - */ - if (use_copy) - setuid(0); - /* Publish the new system service. */ s = publish_service(rp); if (s != OK) { @@ -1192,6 +1179,19 @@ endpoint_t *endpoint; return(s); /* return error */ } + /* The purpose of non-blocking forks is to avoid involving VFS in the forking + * process, because VFS may be blocked on a sendrec() to a MFS that is + * waiting for a endpoint update for a dead driver. We have just published + * that update, but VFS may still be blocked. As a result, VFS may not yet + * have received PM's fork message. Hence, if we call mapdriver5() + * immediately, VFS may not know about the process and thus refuse to add the + * driver entry. The following temporary hack works around this by forcing + * blocking communication from PM to VFS. Once VFS has been made non-blocking + * towards MFS instances, this hack and the entire fork_nb() call can go. + */ + if (use_copy) + setuid(0); + /* Map the new service. */ if (rp->r_dev_nr > 0) { /* set driver map */ if ((s=mapdriver5(rp->r_label, strlen(rp->r_label),