summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorJurij Smakov <jurij@wooyd.org>2006-11-11 14:09:15 +0200
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-11-11 14:13:56 +0200
commitacb5ff4c73ac4d52201d7c421f488e2ead5c8b9c (patch)
tree398635e5a72abd9679e1dcfd64023bbb5fa2ee2f /dix
parentca094684196886a4a1c10273049fae0705a3edc2 (diff)
ffs: handle 0 argument (bug #8968)
Handle an argument of 0 in ffs(), instead of looping indefinitely. Add an ffs prototype to dix.h, and add includes to ffs.c. (cherry picked from 34164e551e4c3909322d50b09835ca4ac1d49d68 commit)
Diffstat (limited to 'dix')
-rw-r--r--dix/ffs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/dix/ffs.c b/dix/ffs.c
index f84f7b47f..b75657d29 100644
--- a/dix/ffs.c
+++ b/dix/ffs.c
@@ -36,6 +36,8 @@ int
ffs(int i)
{
int j;
+ if (i == 0)
+ return 0;
for (j = 1; (i & 1) == 0; j++)
i >>= 1;
return j;