You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No idea why, but the function call returns 0 (which is correct), yet future writes continue from the old location not the new one. I had to change fseek to:
returnfseek((FILE*)params[1],params[2],whence);
And flength to:
intfn=fileno((FILE*)params[1]);
c=lseek(fn,0,SEEK_CUR); /* save the current position */l=lseek(fn,0,SEEK_END); /* return the file position at its end */fseek((FILE*)params[1],c,SEEK_SET); /* restore the file pointer */
The latter uses a mix of lseek and fseek because all of one or the other failed in different ways.
The text was updated successfully, but these errors were encountered:
Reading through POSIX and various documentations there doesn't seem to be any guarantee of relations between a fd and a FILE. Additionally, the C standard allows FILE to store position information. So I think the code is just simply wrong and built on top of incorrect assumptions.
No idea why, but the function call returns
0
(which is correct), yet future writes continue from the old location not the new one. I had to changefseek
to:And
flength
to:The latter uses a mix of
lseek
andfseek
because all of one or the other failed in different ways.The text was updated successfully, but these errors were encountered: