Amit K. Arora wrote:
Might want more error checking in there, something like (rough cut)...
(or is some of this glibc's job?)
> +
> + ret = -EINVAL;
> + if (len == 0 || offset < 0)
> + goto out;
> + ret = -EBADF;
> + if (!(file->f_mode & FMODE_WRITE))
> + goto out_fput;
> + ret = -ESPIPE;
> + if (S_ISFIFO(inode->i_mode))
> + goto out_fput;
> + ret = -ENODEV;
> + if (!S_ISREG(inode->i_mode))
> + goto out_fput;
> + ret = -EFBIG;
> + if (offset + len > inode->i_sb->s_maxbytes)
> + goto out_fput;
> +out_fput:
which would keep things in line with posix_fallocate's specified errors,
too?
-Eric
-