Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
c9b72f97
Commit
c9b72f97
authored
Jan 23, 2017
by
Jan-Erik Rediger
Committed by
GitHub
Jan 23, 2017
Browse files
Merge pull request #499 from jinq0123/fixbug/redisSetErrorFromErrno
Fix __redisSetErrorFromErrno() can not get error string.
parents
33152ad1
25cd884f
Changes
1
Hide whitespace changes
Inline
Side-by-side
net.c
View file @
c9b72f97
...
@@ -65,12 +65,13 @@ static void redisContextCloseFd(redisContext *c) {
...
@@ -65,12 +65,13 @@ static void redisContextCloseFd(redisContext *c) {
}
}
static
void
__redisSetErrorFromErrno
(
redisContext
*
c
,
int
type
,
const
char
*
prefix
)
{
static
void
__redisSetErrorFromErrno
(
redisContext
*
c
,
int
type
,
const
char
*
prefix
)
{
int
errorno
=
errno
;
/* snprintf() may change errno */
char
buf
[
128
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
size_t
len
=
0
;
size_t
len
=
0
;
if
(
prefix
!=
NULL
)
if
(
prefix
!=
NULL
)
len
=
snprintf
(
buf
,
sizeof
(
buf
),
"%s: "
,
prefix
);
len
=
snprintf
(
buf
,
sizeof
(
buf
),
"%s: "
,
prefix
);
__redis_strerror_r
(
errno
,
(
char
*
)(
buf
+
len
),
sizeof
(
buf
)
-
len
);
__redis_strerror_r
(
err
or
no
,
(
char
*
)(
buf
+
len
),
sizeof
(
buf
)
-
len
);
__redisSetError
(
c
,
type
,
buf
);
__redisSetError
(
c
,
type
,
buf
);
}
}
...
...
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