summaryrefslogtreecommitdiff
path: root/libtreefs/s-file.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-10-02 20:30:15 +0200
committerRichard Braun <rbraun@sceen.net>2013-10-02 20:30:15 +0200
commit6c3825f2b750bf9b913c6ea986739e648c470603 (patch)
tree668999faf31004dd9100a8a08eef7c4087b87dab /libtreefs/s-file.c
parenta81c0c28ea606b0d0a2ad5eeb74071c746b7cdeb (diff)
Check for negative sizes in file_set_size
* libdiskfs/file-set-size.c (diskfs_S_file_set_size): Return EINVAL if size is negative. * libnetfs/file-set-size.c (netfs_S_file_set_size): Likewise. * libtreefs/s-file.c (treefs_S_file_set_size): Likewise. * storeio/io.c (trivfs_S_file_set_size): Likewise. * term/users.c (trivfs_S_file_set_size): Likewise. * trans/null.c (trivfs_S_file_set_size): Likewise. * trans/streamio.c (trivfs_S_file_set_size): Likewise.
Diffstat (limited to 'libtreefs/s-file.c')
-rw-r--r--libtreefs/s-file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libtreefs/s-file.c b/libtreefs/s-file.c
index 73c32d7f..c24d645e 100644
--- a/libtreefs/s-file.c
+++ b/libtreefs/s-file.c
@@ -220,6 +220,8 @@ treefs_S_file_set_size (struct treefs_protid *cred, off_t size)
{
if (!cred)
return EOPNOTSUPP;
+ else if (size < 0)
+ return EINVAL;
return treefs_s_file_set_size (cred, size);
}