aboutsummaryrefslogtreecommitdiff
path: root/seek.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-07-19 11:29:27 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2017-07-19 11:29:27 +0300
commit651babfefa21536112cbcd799932b3595aeb2da4 (patch)
tree6922b7ea70642f4ce7a8cb97f01e62115e97d940 /seek.c
parent3e59cfb01443a14962547ed75bbbaaefa25a7633 (diff)
downloadruncap-651babfefa21536112cbcd799932b3595aeb2da4.tar.gz
runcap-651babfefa21536112cbcd799932b3595aeb2da4.tar.bz2
Rename struct filecapture to stream_capture; portability fixes
Diffstat (limited to 'seek.c')
-rw-r--r--seek.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/seek.c b/seek.c
index b69cfe0..2ff6b48 100644
--- a/seek.c
+++ b/seek.c
@@ -20,23 +20,23 @@
#include "runcap.h"
int
-runcap_seek(struct runcap *rc, int stream, off_t off, int whence)
+runcap_seek(struct runcap *rc, int sd, off_t off, int whence)
{
- struct filecapture *fp;
+ struct stream_capture *cap;
off_t cur;
- fp = runcap_filecapture(rc, stream);
- if (!fp)
+ cap = runcap_stream_capture(rc, sd);
+ if (!cap)
return -1;
- cur = runcap_tell(rc, stream);
+ cur = runcap_tell(rc, sd);
switch (whence) {
case SEEK_CUR:
off = cur;
break;
case SEEK_END:
- off = fp->fc_leng + off;
+ off = cap->sc_leng + off;
break;
case SEEK_SET:
@@ -52,15 +52,15 @@ runcap_seek(struct runcap *rc, int stream, off_t off, int whence)
return -1;
}
- cur -= fp->fc_level;
+ cur -= cap->sc_level;
- if (cur <= off && off <= cur + fp->fc_level) {
- fp->fc_cur = off - cur;
- } else if (fp->fc_tmpfd != -1) {
- if (lseek(fp->fc_tmpfd, off, SEEK_SET) == -1)
+ if (cur <= off && off <= cur + cap->sc_level) {
+ cap->sc_cur = off - cur;
+ } else if (cap->sc_storfd != -1) {
+ if (lseek(cap->sc_storfd, off, SEEK_SET) == -1)
return -1;
- fp->fc_level = 0;
- fp->fc_cur = 0;
+ cap->sc_level = 0;
+ cap->sc_cur = 0;
} else {
errno = EINVAL;
return -1;

Return to:

Send suggestions and report system problems to the System administrator.