vfs: fix clobbering fd_nr
dumpcore: fd_nr can be in use as blocking fd but will then be clobbered by common_open, causing disaster for exiting unpause().
This commit is contained in:
parent
faa032f15c
commit
8aeac26999
|
@ -726,6 +726,12 @@ int pm_dumpcore(endpoint_t proc_e, int csig, vir_bytes exe_name)
|
||||||
okendpt(proc_e, &slot);
|
okendpt(proc_e, &slot);
|
||||||
fp = &fproc[slot];
|
fp = &fproc[slot];
|
||||||
|
|
||||||
|
/* if a process is blocked, scratch(fp).file.fd_nr holds the fd it's blocked
|
||||||
|
* on. free it up for use by common_open().
|
||||||
|
*/
|
||||||
|
if (fp_is_blocked(fp))
|
||||||
|
unpause(fp->fp_endpoint);
|
||||||
|
|
||||||
/* open core file */
|
/* open core file */
|
||||||
snprintf(core_path, PATH_MAX, "%s.%d", CORE_NAME, fp->fp_pid);
|
snprintf(core_path, PATH_MAX, "%s.%d", CORE_NAME, fp->fp_pid);
|
||||||
core_fd = common_open(core_path, O_WRONLY | O_CREAT | O_TRUNC, CORE_MODE);
|
core_fd = common_open(core_path, O_WRONLY | O_CREAT | O_TRUNC, CORE_MODE);
|
||||||
|
|
Loading…
Reference in a new issue