aboutsummaryrefslogtreecommitdiffstats
path: root/src/estream.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/estream.c')
-rw-r--r--src/estream.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/estream.c b/src/estream.c
index 8ad664e..72e93e0 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -820,6 +820,14 @@ func_mem_ioctl (void *cookie, int cmd, void *ptr, size_t *len)
mem_cookie->offset = 0;
ret = 0;
}
+ else if (cmd == COOKIE_IOCTL_TRUNCATE)
+ {
+ gpgrt_off_t length = *(gpgrt_off_t *)ptr;
+
+ ret = func_mem_seek (cookie, &length, SEEK_SET);
+ if (ret != -1)
+ mem_cookie->data_len = mem_cookie->offset;
+ }
else
{
_set_errno (EINVAL);
@@ -4027,6 +4035,29 @@ _gpgrt_rewind (estream_t stream)
int
+_gpgrt_ftruncate (estream_t stream, gpgrt_off_t length)
+{
+ cookie_ioctl_function_t func_ioctl;
+ int ret;
+
+ lock_stream (stream);
+ func_ioctl = stream->intern->func_ioctl;
+ if (!func_ioctl)
+ {
+ _set_errno (EOPNOTSUPP);
+ ret = -1;
+ }
+ else
+ {
+ ret = func_ioctl (stream->intern->cookie, COOKIE_IOCTL_TRUNCATE,
+ &length, NULL);
+ }
+ unlock_stream (stream);
+ return ret;
+}
+
+
+int
_gpgrt__getc_underflow (estream_t stream)
{
int err;