diff options
-rw-r--r-- | kernel/exit.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 1daa7f46bccd..2cc69eb8db2a 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -1645,32 +1645,6 @@ notask: | |||
1645 | end: | 1645 | end: |
1646 | __set_current_state(TASK_RUNNING); | 1646 | __set_current_state(TASK_RUNNING); |
1647 | remove_wait_queue(¤t->signal->wait_chldexit, &wo->child_wait); | 1647 | remove_wait_queue(¤t->signal->wait_chldexit, &wo->child_wait); |
1648 | |||
1649 | if (wo->wo_info) { | ||
1650 | struct siginfo __user *infop = wo->wo_info; | ||
1651 | |||
1652 | if (retval > 0) | ||
1653 | retval = 0; | ||
1654 | else { | ||
1655 | /* | ||
1656 | * For a WNOHANG return, clear out all the fields | ||
1657 | * we would set so the user can easily tell the | ||
1658 | * difference. | ||
1659 | */ | ||
1660 | if (!retval) | ||
1661 | retval = put_user(0, &infop->si_signo); | ||
1662 | if (!retval) | ||
1663 | retval = put_user(0, &infop->si_errno); | ||
1664 | if (!retval) | ||
1665 | retval = put_user(0, &infop->si_code); | ||
1666 | if (!retval) | ||
1667 | retval = put_user(0, &infop->si_pid); | ||
1668 | if (!retval) | ||
1669 | retval = put_user(0, &infop->si_uid); | ||
1670 | if (!retval) | ||
1671 | retval = put_user(0, &infop->si_status); | ||
1672 | } | ||
1673 | } | ||
1674 | return retval; | 1648 | return retval; |
1675 | } | 1649 | } |
1676 | 1650 | ||
@@ -1715,6 +1689,29 @@ SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *, | |||
1715 | wo.wo_stat = NULL; | 1689 | wo.wo_stat = NULL; |
1716 | wo.wo_rusage = ru; | 1690 | wo.wo_rusage = ru; |
1717 | ret = do_wait(&wo); | 1691 | ret = do_wait(&wo); |
1692 | |||
1693 | if (ret > 0) { | ||
1694 | ret = 0; | ||
1695 | } else if (infop) { | ||
1696 | /* | ||
1697 | * For a WNOHANG return, clear out all the fields | ||
1698 | * we would set so the user can easily tell the | ||
1699 | * difference. | ||
1700 | */ | ||
1701 | if (!ret) | ||
1702 | ret = put_user(0, &infop->si_signo); | ||
1703 | if (!ret) | ||
1704 | ret = put_user(0, &infop->si_errno); | ||
1705 | if (!ret) | ||
1706 | ret = put_user(0, &infop->si_code); | ||
1707 | if (!ret) | ||
1708 | ret = put_user(0, &infop->si_pid); | ||
1709 | if (!ret) | ||
1710 | ret = put_user(0, &infop->si_uid); | ||
1711 | if (!ret) | ||
1712 | ret = put_user(0, &infop->si_status); | ||
1713 | } | ||
1714 | |||
1718 | put_pid(pid); | 1715 | put_pid(pid); |
1719 | 1716 | ||
1720 | /* avoid REGPARM breakage on x86: */ | 1717 | /* avoid REGPARM breakage on x86: */ |