Opened 12 years ago
Closed 12 years ago
#273 closed defect (fixed)
fcntl() fails
| Reported by: | Silvan Scherrer | Owned by: | Silvan Scherrer |
|---|---|---|---|
| Priority: | highest | Milestone: | libc-0.6.6 |
| Component: | libc | Version: | |
| Severity: | blocker | Keywords: | |
| Cc: |
Description
given this code:
fl.l_type = rw;
fl.l_whence = SEEK_SET;
fl.l_start = off;
fl.l_len = len;
fl.l_pid = 0;
if (waitflag)
return fcntl(tdb->fd, F_SETLKW, &fl);
else
return fcntl(tdb->fd, F_SETLK, &fl);
where len == 0 and off == 692
libc produces this log:
014759df 01 04 0004 Entr 0000 __fcntl_locking: fh=3 iRequest=9 pFlock=0x025bedf8 014759df 01 04 0004 ErrL 0000 __fcntl_locking (0 ms): D:/CODING/LIBC/0.6/src/emx/src/lib/sys/b_ioFileControl.c(334): 014759df 01 04 0004 ErrL 0000: ret -EINVAL - Invalid offStart=2b4 cbRange=7fffffffffffffff 014759df 01 03 0004 ErrL 0000 __libc_Back_ioFileControlStandard (0 ms): D:/CODING/LIBC/0.6/src/emx/src/lib/sys/b_ioFileControl.c(178):
i guess this libc check is wrong:
if ( offStart < 0
|| cbRange + offStart < 0)
LIBCLOG_ERROR_RETURN_MSG(-EINVAL, "ret -EINVAL - Invalid offStart=%llx cbRange=%llx\n", offStart, cbRange);
in the case that cbRange is OFF_MAX the check should also succeed.
Change History (5)
comment:1 by , 12 years ago
| Milestone: | → libc-0.6.6 |
|---|
comment:2 by , 12 years ago
comment:3 by , 12 years ago
| Owner: | set to |
|---|---|
| Status: | new → accepted |
comment:4 by , 12 years ago
| Component: | baselayout → libc |
|---|
comment:5 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | accepted → closed |
Thanks tracking this one down. Fixed in r3844.
Note:
See TracTickets
for help on using tickets.

if (offStart < 0 || (cbRange != OFF_MAX && cbRange + offStart < 0))the above should fix the error