summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
33ecbdb)
*/
#include <emul/kfile_posix.h>
*/
#include <emul/kfile_posix.h>
static size_t kfile_posix_read(struct KFile *_fd, void *buf, size_t size)
{
static size_t kfile_posix_read(struct KFile *_fd, void *buf, size_t size)
{
break;
default:
ASSERT(0);
break;
default:
ASSERT(0);
+ int err = fseek(fd->fp, offset, std_whence);
+ if (err)
+ return err;
- return fseek(fd->fp, offset, std_whence);
}
static int kfile_posix_close(struct KFile *_fd)
}
static int kfile_posix_close(struct KFile *_fd)
FILE *kfile_posix_init(KFilePosix *file, const char *filename, const char *mode)
{
FILE *kfile_posix_init(KFilePosix *file, const char *filename, const char *mode)
{
- file->fd._type = KFT_KFILEPOSIX;
+ memset(file, 0, sizeof(*file));
+ DB(file->fd._type = KFT_KFILEPOSIX);
file->fd.read = kfile_posix_read;
file->fd.write = kfile_posix_write;
file->fd.close = kfile_posix_close;
file->fd.read = kfile_posix_read;
file->fd.write = kfile_posix_write;
file->fd.close = kfile_posix_close;