summaryrefslogtreecommitdiff
path: root/libpipe/seqpack.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpipe/seqpack.c')
-rw-r--r--libpipe/seqpack.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libpipe/seqpack.c b/libpipe/seqpack.c
index 44a15a03..041abb74 100644
--- a/libpipe/seqpack.c
+++ b/libpipe/seqpack.c
@@ -43,8 +43,17 @@ static error_t
seqpack_read (struct packet *packet, int *dequeue, unsigned *flags,
char **data, size_t *data_len, size_t amount)
{
- error_t err = packet_read (packet, data, data_len, amount);
- *dequeue = (packet_readable (packet) == 0);
+ error_t err;
+ if (flags && *flags & MSG_PEEK)
+ {
+ err = packet_peek (packet, data, data_len, amount);
+ *dequeue = 0;
+ }
+ else
+ {
+ err = packet_read (packet, data, data_len, amount);
+ *dequeue = (packet_readable (packet) == 0);
+ }
return err;
}