... |
... |
@@ -4,9 +4,9 @@ Subject: Fix type of offset arguments to splice |
4
|
4
|
|
5
|
5
|
Bug-Debian: https://bugs.debian.org/1078218
|
6
|
6
|
---
|
7
|
|
- src/extUnix.pp.ml | 2 +-
|
8
|
|
- src/splice.c | 2 +-
|
9
|
|
- 2 files changed, 2 insertions(+), 2 deletions(-)
|
|
7
|
+ src/extUnix.pp.ml | 2 +-
|
|
8
|
+ src/splice.c | 15 +++++++++++----
|
|
9
|
+ 2 files changed, 12 insertions(+), 5 deletions(-)
|
10
|
10
|
|
11
|
11
|
diff --git a/src/extUnix.pp.ml b/src/extUnix.pp.ml
|
12
|
12
|
index 8726c35..8894c4f 100644
|
... |
... |
@@ -22,15 +22,36 @@ index 8726c35..8894c4f 100644 |
22
|
22
|
|
23
|
23
|
[%%have TEE
|
24
|
24
|
diff --git a/src/splice.c b/src/splice.c
|
25
|
|
-index 5fb9b6d..2aa73bc 100644
|
|
25
|
+index 5fb9b6d..15eb84e 100644
|
26
|
26
|
--- a/src/splice.c
|
27
|
27
|
+++ b/src/splice.c
|
28
|
|
-@@ -17,7 +17,7 @@ static int splice_flags[] =
|
|
28
|
+@@ -15,9 +15,14 @@ static int splice_flags[] =
|
|
29
|
+ #endif
|
|
30
|
+
|
29
|
31
|
#if defined(EXTUNIX_HAVE_SPLICE)
|
30
|
|
- static loff_t* get_offset(value v_off)
|
|
32
|
+-static loff_t* get_offset(value v_off)
|
|
33
|
++static inline loff_t* get_offset(value v_off, loff_t *off)
|
31
|
34
|
{
|
32
|
35
|
- return (Is_long(v_off) ? NULL : &(Field(v_off, 0)));
|
33
|
|
-+ return (Is_long(v_off) ? NULL : &Int64_val(Field(v_off, 0)));
|
|
36
|
++ if (Is_long(v_off)) {
|
|
37
|
++ return NULL;
|
|
38
|
++ } else {
|
|
39
|
++ *off = Int64_val(Field(v_off, 0));
|
|
40
|
++ return off;
|
|
41
|
++ }
|
34
|
42
|
}
|
35
|
43
|
|
36
|
44
|
CAMLprim value caml_extunix_splice(value v_fd_in, value v_off_in, value v_fd_out, value v_off_out, value v_len, value v_flags)
|
|
45
|
+@@ -28,8 +33,10 @@ CAMLprim value caml_extunix_splice(value v_fd_in, value v_off_in, value v_fd_out
|
|
46
|
+ unsigned int flags = caml_convert_flag_list(v_flags, splice_flags);
|
|
47
|
+ int fd_in = Int_val(v_fd_in);
|
|
48
|
+ int fd_out = Int_val(v_fd_out);
|
|
49
|
+- loff_t* off_in = get_offset(v_off_in);
|
|
50
|
+- loff_t* off_out = get_offset(v_off_out);
|
|
51
|
++ loff_t a_off_in = 0;
|
|
52
|
++ loff_t a_off_out = 0;
|
|
53
|
++ loff_t *off_in = get_offset(v_off_in, &a_off_in);
|
|
54
|
++ loff_t *off_out = get_offset(v_off_out, &a_off_out);
|
|
55
|
+ size_t len = Int_val(v_len);
|
|
56
|
+ ssize_t ret;
|
|
57
|
+ |