Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
23c8faaf
Commit
23c8faaf
authored
Nov 14, 2008
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
buf fix: make FD.Read, FD.Write work for empty buffers
R=r DELTA=8 (6 added, 0 deleted, 2 changed) OCL=19273 CL=19275
parent
f3e354ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
os_file.go
src/lib/os/os_file.go
+8
-2
No files found.
src/lib/os/os_file.go
View file @
23c8faaf
...
...
@@ -57,7 +57,10 @@ func (fd *FD) Read(b *[]byte) (ret int, err *Error) {
if
fd
==
nil
{
return
-
1
,
EINVAL
}
r
,
e
:=
syscall
.
read
(
fd
.
fd
,
&
b
[
0
],
int64
(
len
(
b
)));
var
r
,
e
int64
;
if
len
(
b
)
>
0
{
// because we access b[0]
r
,
e
=
syscall
.
read
(
fd
.
fd
,
&
b
[
0
],
int64
(
len
(
b
)));
}
return
int
(
r
),
ErrnoToError
(
e
)
}
...
...
@@ -65,7 +68,10 @@ func (fd *FD) Write(b *[]byte) (ret int, err *Error) {
if
fd
==
nil
{
return
-
1
,
EINVAL
}
r
,
e
:=
syscall
.
write
(
fd
.
fd
,
&
b
[
0
],
int64
(
len
(
b
)));
var
r
,
e
int64
;
if
len
(
b
)
>
0
{
// because we access b[0]
r
,
e
=
syscall
.
write
(
fd
.
fd
,
&
b
[
0
],
int64
(
len
(
b
)));
}
return
int
(
r
),
ErrnoToError
(
e
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment