[Win32utils-devel] [ win32utils-Bugs-4598 ] possible wrong condition
noreply at rubyforge.org
noreply at rubyforge.org
Sun Jun 18 13:07:52 EDT 2006
Bugs item #4598, was opened at 2006-05-29 08:20
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=411&aid=4598&group_id=85
Category: win32-eventlog
Group: None
Status: Open
Resolution: Accepted
Priority: 3
Submitted By: Nobody (None)
Assigned to: Daniel Berger (djberg96)
Summary: possible wrong condition
Initial Comment:
Is this condition right?
(eventlog.rb, line 494
if flags | EVENTLOG_SEEK_READ > 0
offset = buf[8,4].unpack('L').first + 1
end
To me it seems that it is always true as E_S_R == 2.
Maybe this is how it was meant:
unless flags & EVENTLOG_SEEK_READ > 0
I haven't understood the rest of the code, so I'm not sure about the solution.
Jano Svitok
----------------------------------------------------------------------
>Comment By: Daniel Berger (djberg96)
Date: 2006-06-18 10:07
Message:
Here was the final patch, applied to CVS:
if flags & EVENTLOG_BACKWARDS_READ > 0
offset = buf[8,4].unpack('L').first - 1
else
offset = buf[8,4].unpack('L').first + 1
end
This will be in the next release.
Dan
----------------------------------------------------------------------
Comment By: Daniel Berger (djberg96)
Date: 2006-05-29 10:38
Message:
Not only is the code wrong, some testing revealed that code was the source of another bug. Specifically, a seek + backwards read would loop infinitely.
I believe this is the proper code:
if flags & EVENTLOG_SEEK_READ > 0
if flags & EVENTLOG_FORWARDS_READ > 0
offset = buf[8,4].unpack('L').first + 1
else
offset = buf[8,4].unpack('L').first - 1
end
end
I'll add some more tests for this. Many thanks for the report!
- Dan
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=411&aid=4598&group_id=85
More information about the win32utils-devel
mailing list