Commit 4415d8a5aaec2008833e1c474b38627c0bc738ca

Authored by WANG Cong
Committed by Linus Torvalds
1 parent 074a0db8e1

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>

Showing 1 changed file with 8 additions and 4 deletions Side-by-side Diff

arch/um/os-Linux/sys-i386/task_size.c
... ... @@ -88,7 +88,10 @@
88 88 sa.sa_handler = segfault;
89 89 sigemptyset(&sa.sa_mask);
90 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 96 if (!page_ok(bottom)) {
94 97 fprintf(stderr, "Address 0x%x no good?\n",
95 98  
... ... @@ -110,11 +113,12 @@
110 113  
111 114 out:
112 115 /* Restore the old SIGSEGV handling */
113   - sigaction(SIGSEGV, &old, NULL);
114   -
  116 + if (sigaction(SIGSEGV, &old, NULL)) {
  117 + perror("os_get_task_size");
  118 + exit(1);
  119 + }
115 120 top <<= UM_KERN_PAGE_SHIFT;
116 121 printf("0x%x\n", top);
117   - fflush(stdout);
118 122  
119 123 return top;
120 124 }