diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2004-01-21 20:12:23 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2004-01-21 20:12:23 +0000 |
| commit | fb6b710c39b8bbefd730af2d2b8704bd646e0456 (patch) | |
| tree | ef59111118b96cb170e58b13a12c868718248613 /lib/libstand/splitfs.c | |
| parent | 58d120f6d3f64212029d24d68f7ea3212f07974b (diff) | |
Notes
Diffstat (limited to 'lib/libstand/splitfs.c')
| -rw-r--r-- | lib/libstand/splitfs.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libstand/splitfs.c b/lib/libstand/splitfs.c index 87924640ff50..35593ad05cfd 100644 --- a/lib/libstand/splitfs.c +++ b/lib/libstand/splitfs.c @@ -250,6 +250,9 @@ splitfs_seek(struct open_file *f, off_t offset, int where) case SEEK_END: panic("splitfs_seek: SEEK_END not supported"); break; + default: + errno = EINVAL; + return (-1); } if (seek_by > 0) { @@ -261,8 +264,10 @@ splitfs_seek(struct open_file *f, off_t offset, int where) void *tmp; tmp = malloc(SEEK_BUF); - if (tmp == NULL) + if (tmp == NULL) { + errno = ENOMEM; return (-1); + } nread = 0; for (; seek_by > 0; seek_by -= nread) { @@ -283,8 +288,10 @@ splitfs_seek(struct open_file *f, off_t offset, int where) if (sf->file_pos + seek_by < 0) panic("splitfs_seek: can't seek past the beginning of the slice"); new_pos = lseek(sf->curfd, seek_by, SEEK_CUR); - if (new_pos < 0) + if (new_pos < 0) { + errno = EINVAL; return (-1); + } sf->tot_pos += new_pos - sf->file_pos; sf->file_pos = new_pos; } |
