diff -urNp 2.4.19pre9ac1/fs/locks.c 2.4.19pre9ac2/fs/locks.c --- 2.4.19pre9ac1/fs/locks.c Thu May 30 16:08:03 2002 +++ 2.4.19pre9ac2/fs/locks.c Thu May 30 18:07:49 2002 @@ -273,9 +273,18 @@ static int flock_to_posix_lock(struct fi return -EINVAL; } - if (((start += l->l_start) < 0) || (l->l_len < 0)) + /* POSIX-1996 leaves the case l->l_len < 0 undefined; + POSIX-2001 defines it. */ + start += l->l_start; + if (l->l_len < 0) { + end = start - 1; + start += l->l_len; + } else { + end = start + l->l_len - 1; + } + + if (start < 0) return -EINVAL; - end = start + l->l_len - 1; if (l->l_len > 0 && end < 0) return -EOVERFLOW; fl->fl_start = start; /* we record the absolute position */