summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2008-04-28 02:13:57 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 08:58:28 -0700
commit4415d8a5aaec2008833e1c474b38627c0bc738ca (patch)
treeec6c96b7fe46b43f96bf0248ad95420cb7424d07 /arch
parent074a0db8e17ae271736148809c5f9d47dec2d993 (diff)
downloadlinux-stable-4415d8a5aaec2008833e1c474b38627c0bc738ca.tar.gz
linux-stable-4415d8a5aaec2008833e1c474b38627c0bc738ca.tar.bz2
linux-stable-4415d8a5aaec2008833e1c474b38627c0bc738ca.zip
arch/um/os-Linux/sys-i386/task_size.c: improve a bit
Improve this code a bit: check sigaction's return value and remove a useless fflush(). Acked-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: WANG Cong <wangcong@zeuux.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/os-Linux/sys-i386/task_size.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/um/os-Linux/sys-i386/task_size.c b/arch/um/os-Linux/sys-i386/task_size.c
index 48d211b3d9a1..ccb49b0aff59 100644
--- a/arch/um/os-Linux/sys-i386/task_size.c
+++ b/arch/um/os-Linux/sys-i386/task_size.c
@@ -88,7 +88,10 @@ unsigned long os_get_task_size(void)
sa.sa_handler = segfault;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_NODEFER;
- sigaction(SIGSEGV, &sa, &old);
+ if (sigaction(SIGSEGV, &sa, &old)) {
+ perror("os_get_task_size");
+ exit(1);
+ }
if (!page_ok(bottom)) {
fprintf(stderr, "Address 0x%x no good?\n",
@@ -110,11 +113,12 @@ unsigned long os_get_task_size(void)
out:
/* Restore the old SIGSEGV handling */
- sigaction(SIGSEGV, &old, NULL);
-
+ if (sigaction(SIGSEGV, &old, NULL)) {
+ perror("os_get_task_size");
+ exit(1);
+ }
top <<= UM_KERN_PAGE_SHIFT;
printf("0x%x\n", top);
- fflush(stdout);
return top;
}