Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
86f2731e
Commit
86f2731e
authored
Nov 12, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syscall: Force first letter of error message to lower case.
From-SVN: r193449
parent
36a41ef1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
libgo/go/syscall/errstr.go
+10
-5
libgo/go/syscall/errstr_linux.go
+5
-0
libgo/go/syscall/errstr_nor.go
+9
-1
No files found.
libgo/go/syscall/errstr.go
View file @
86f2731e
...
...
@@ -6,22 +6,27 @@
package
syscall
//sysnb strerror_r(errnum int, buf []byte) (err
error
)
//sysnb strerror_r(errnum int, buf []byte) (err
Errno
)
//strerror_r(errnum _C_int, buf *byte, buflen Size_t) _C_int
func
Errstr
(
errnum
int
)
string
{
for
len
:=
128
;
;
len
*=
2
{
b
:=
make
([]
byte
,
len
)
err
:=
strerror_r
(
errnum
,
b
)
if
err
==
nil
{
err
no
:=
strerror_r
(
errnum
,
b
)
if
err
no
==
0
{
i
:=
0
for
b
[
i
]
!=
0
{
i
++
}
// Lowercase first letter: Bad -> bad, but
// STREAM -> STREAM.
if
i
>
1
&&
'A'
<=
b
[
0
]
&&
b
[
0
]
<=
'Z'
&&
'a'
<=
b
[
1
]
&&
b
[
1
]
<=
'z'
{
b
[
0
]
+=
'a'
-
'A'
}
return
string
(
b
[
:
i
])
}
if
err
!=
ERANGE
{
return
"
E
rrstr failure"
if
err
no
!=
ERANGE
{
return
"
e
rrstr failure"
}
}
}
libgo/go/syscall/errstr_linux.go
View file @
86f2731e
...
...
@@ -19,5 +19,10 @@ func Errstr(errnum int) string {
for
b
[
i
]
!=
0
{
i
++
}
// Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
if
i
>
1
&&
'A'
<=
b
[
0
]
&&
b
[
0
]
<=
'Z'
&&
'a'
<=
b
[
1
]
&&
b
[
1
]
<=
'z'
{
c
:=
b
[
0
]
+
'a'
-
'A'
return
string
(
c
)
+
string
(
b
[
1
:
i
])
}
return
string
(
b
[
:
i
])
}
libgo/go/syscall/errstr_nor.go
View file @
86f2731e
...
...
@@ -25,7 +25,15 @@ func Errstr(errno int) string {
for
b
[
i
]
!=
0
{
i
++
}
s
:=
string
(
b
[
:
i
])
// Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
var
s
string
if
i
>
1
&&
'A'
<=
b
[
0
]
&&
b
[
0
]
<=
'Z'
&&
'a'
<=
b
[
1
]
&&
b
[
1
]
<=
'z'
{
c
:=
b
[
0
]
+
'a'
-
'A'
s
=
string
(
c
)
+
string
(
b
[
1
:
i
])
}
else
{
s
=
string
(
b
[
:
i
])
}
errstr_lock
.
Unlock
()
...
...
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