lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
944 stars 385 forks source link

add seekable check (eg: fifo) #515

Open zxlxz opened 3 weeks ago

zxlxz commented 3 weeks ago

some file cannot use feek. eg: fifo, network mount filesystem.

ihilt commented 1 week ago

Hello @zxlxz and thank you for this pull request!

My thought on this is that there are several function calls in eventlog.c which use fseeko or other functions which expect a seekable stream. If we review the way in which these functions are used in eventlog.c, it does not appear that this code would work as expected if those functions were bypassed. This leads me to the conclusion that the constructor function for lcm_eventlog_t (lcm_eventlog_create) should detect whether path is a seekable stream and if not, report that to the user, and then return NULL since the eventlog wouldn't work correctly.

Does that make sense to you?