diff options
| author | WANG Cong <xiyou.wangcong@gmail.com> | 2008-04-28 05:13:57 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:28 -0400 |
| commit | 4415d8a5aaec2008833e1c474b38627c0bc738ca (patch) | |
| tree | ec6c96b7fe46b43f96bf0248ad95420cb7424d07 /arch | |
| parent | 074a0db8e17ae271736148809c5f9d47dec2d993 (diff) | |
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.c | 12 |
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) | |||
| 88 | sa.sa_handler = segfault; | 88 | sa.sa_handler = segfault; |
| 89 | sigemptyset(&sa.sa_mask); | 89 | sigemptyset(&sa.sa_mask); |
| 90 | sa.sa_flags = SA_NODEFER; | 90 | sa.sa_flags = SA_NODEFER; |
| 91 | sigaction(SIGSEGV, &sa, &old); | 91 | if (sigaction(SIGSEGV, &sa, &old)) { |
| 92 | perror("os_get_task_size"); | ||
| 93 | exit(1); | ||
| 94 | } | ||
| 92 | 95 | ||
| 93 | if (!page_ok(bottom)) { | 96 | if (!page_ok(bottom)) { |
| 94 | fprintf(stderr, "Address 0x%x no good?\n", | 97 | fprintf(stderr, "Address 0x%x no good?\n", |
| @@ -110,11 +113,12 @@ unsigned long os_get_task_size(void) | |||
| 110 | 113 | ||
| 111 | out: | 114 | out: |
| 112 | /* Restore the old SIGSEGV handling */ | 115 | /* Restore the old SIGSEGV handling */ |
| 113 | sigaction(SIGSEGV, &old, NULL); | 116 | if (sigaction(SIGSEGV, &old, NULL)) { |
| 114 | 117 | perror("os_get_task_size"); | |
| 118 | exit(1); | ||
| 119 | } | ||
| 115 | top <<= UM_KERN_PAGE_SHIFT; | 120 | top <<= UM_KERN_PAGE_SHIFT; |
| 116 | printf("0x%x\n", top); | 121 | printf("0x%x\n", top); |
| 117 | fflush(stdout); | ||
| 118 | 122 | ||
| 119 | return top; | 123 | return top; |
| 120 | } | 124 | } |
