summaryrefslogtreecommitdiff
path: root/debian/patches/gccgo-sendfile-fix.diff
blob: 9caa529083802bf9bdaae70caa637364bf07b62f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# DP: libgo: syscall.Sendfile(): Apply proposed patch for PR go/66378.

From: Michael Vogt <mvo@ubuntu.com>
Description: syscall.Sendfile() needs to set the offset.
 Previously it was not setting or using the user provided offset at all.
 See sendfile(2) for details about the semantic of "offset".

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gccgo-5/+bug/1460530
Index: b/src/libgo/go/syscall/libcall_linux.go
===================================================================
--- a/src/libgo/go/syscall/libcall_linux.go
+++ b/src/libgo/go/syscall/libcall_linux.go
@@ -318,21 +318,13 @@ func Pipe2(p []int, flags int) (err erro
 //sys	Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
 //renameat(olddirfd _C_int, oldpath *byte, newdirfd _C_int, newpath *byte) _C_int
 
-//sys	sendfile(outfd int, infd int, offset *Offset_t, count int) (written int, err error)
-//sendfile64(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t
+//sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
+//sendfile64(outfd _C_int, infd _C_int, offset *int64, count Size_t) Ssize_t
 func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 	if raceenabled {
 		raceReleaseMerge(unsafe.Pointer(&ioSync))
 	}
-	var soff Offset_t
-	var psoff *Offset_t
-	if offset != nil {
-		psoff = &soff
-	}
-	written, err = sendfile(outfd, infd, psoff, count)
-	if offset != nil {
-		*offset = int64(soff)
-	}
+	written, err = sendfile(outfd, infd, offset, count)
 	return
 }