Skip to content

Commit

Permalink
tst-getcpu: decode errno when sched_getcpu fails
Browse files Browse the repository at this point in the history
The tst-getcpu test is failing on ia64 platforms due to sched_getcpu
returning an error.  But the current test only considers -1 when it's
also ENOSYS.  Tweak the logic a bit to make the output clearer.

Signed-off-by: Mike Frysinger <[email protected]>
  • Loading branch information
vapier committed Jun 5, 2012
1 parent 3cc0cd4 commit 1214ec8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2012-06-04 Mike Frysinger <[email protected]>

* sysdeps/unix/sysv/linux/tst-getcpu.c (do_test): Call perror when
cpu2 is -1 and errno is not ENOSYS.

2012-06-04 H.J. Lu <[email protected]>

[BZ #14117]
Expand Down
11 changes: 8 additions & 3 deletions sysdeps/unix/sysv/linux/tst-getcpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ do_test (void)
else
{
int cpu2 = sched_getcpu ();
if (cpu2 == -1 && errno == ENOSYS)
if (cpu2 == -1)
{
puts ("getcpu syscall not implemented");
return 0;
if (errno == ENOSYS)
{
puts ("getcpu syscall not implemented");
return 0;
}
perror ("getcpu failed");
result = 1;
}
if (cpu2 != cpu)
{
Expand Down

0 comments on commit 1214ec8

Please sign in to comment.