Commit Graph

610 Commits

Author SHA1 Message Date
Jin Qing
25cd884f6b Fix __redisSetErrorFromErrno() can not get error string.
snprintf() may change errno.
2016-12-30 23:13:02 +08:00
not-a-robot
33152ad163 Auto merge of #429 - xinchuantao:master, r=badboy
using new version libevent
2016-12-09 11:37:25 +01:00
not-a-robot
b4f9fc1a2a Auto merge of #468 - paul-scott:master, r=badboy
Prevented uv adapter from calling write when context has been freed

The `redisLibuvPoll` function can be called with both the `UV_READABLE` and `UV_WRITABLE` flags set at the same time.  Calling `redisAsyncHandleRead` can lead to a disconnect and the context being cleaned up/freed.  If this happens then `redisAsyncHandleWrite` should not be called otherwise memory read/write errors and duplicate freeing will occur.

These changes prevent this from happening by having the `redisLibuvCleanup` callback indicate that the context has been cleaned.  This is done indirectly by setting the context to a null pointer, maybe someone can come up with a cleaner way.
2016-12-09 11:12:16 +01:00
Jan-Erik Rediger
8636d90821 Avoid unchecked malloc
Closes #471
2016-12-09 10:51:26 +01:00
Jan-Erik Rediger
afdef3e6ec Merge pull request #479 from DonaldWhyte/patch-1
Remove trailing comma in redisConnectionType enum
2016-11-04 15:22:16 +01:00
Donald Whyte
41b07dab5e Remove trailing comma in redisConnectionType enum
Remove trailing comma in last value of `redisConnectionType` enum. This causes a compiler warning on Solaris compilers. I'd like to build this on Solaris with `-Werror`. However, due to the trailing comma, I cannot do that.

This PR removes the trailing comma, which should prevent it causing compiler warnings on any architecture.
2016-10-25 09:25:24 +01:00
Trustfarm-heart
06eedd8a24 Build error patch with glib-2.0
In case of some glib-2.0 linker error ,
make examples 
can't link with glib2.0,  in this case -lglib-2.0  to after includes and move to last will solve the issues.
2016-10-10 04:17:28 +09:00
Hyungjin Kim
073dc84399 Counting pending subscribe. Fix #396 2016-09-30 00:26:32 +09:00
Paul Scott
cbb956567b Prevented uv adapter from calling write when context has been freed 2016-09-19 11:48:54 +10:00
not-a-robot
5f98e1d35d Auto merge of #445 - xxvv:master, r=badboy
fix: should close socket fd when retry connect (tcp)
2016-07-09 13:26:58 +02:00
WSL
64d1ec8342 fix: should close socket fd when retry connet remote (tcp) 2016-07-07 17:02:06 +08:00
not-a-robot
b7205d35fd Auto merge of #440 - redis:pr-438, r=badboy
Test on OSX

Thanks to @tnm & @xor-gate
2016-06-20 11:50:03 +02:00
not-a-robot
847f3fe5c7 Auto merge of #428 - avatli:patch-1, r=badboy
Update sds.h

Fixing sds.h for building hiredis in cpp project
2016-06-20 11:37:14 +02:00
not-a-robot
ef372ed2f0 Auto merge of #439 - tnm:fmacros-fix, r=badboy
Do not define _XOPEN_SOURCE for OS X

redis@bb1747b appears to have introduced a build regression for OS X (and possibly elsewhere, I've only tested on a local Mac environment) — in master right now `make` reliably fails on OS X as reported in redis#431.

There looks to be another PR to fix the issue in redis#433.

This PR here simply returns to the previous behavior on OS X in a minimally-invasive way. There are of course a few different ways to do this with the directives; feel free to do something different, I just care that master can build on OS X 🙇
2016-06-20 11:37:10 +02:00
Jan-Erik Rediger
9deb78140f chore(CI): Exclude valgrind jobs on OSX 2016-06-20 11:08:34 +02:00
Ted Nyman
bc0ea5c466 Do not define _XOPEN_SOURCE for OS X
Resolves failed `make` on OS X.
2016-06-19 22:14:41 -07:00
Ted Nyman
16a459d008 Add a before_script for the OS X environment 2016-06-19 22:05:34 -07:00
Ted Nyman
fa3774081e Test on Travis for both linux and osx 2016-06-19 21:49:44 -07:00
Chris.Xin
386802e809 using new version libevent 2016-05-20 18:55:57 +08:00
Ali Volkan ATLI
f5b32e2474 Update sds.h
Fixing sds.h for building hiredis in cpp project
2016-05-14 23:11:33 +03:00
not-a-robot
e30db1a3be Auto merge of #427 - redis:pr-426, r=badboy
Pr 426

Closes #426, now with test
2016-05-14 11:45:18 +02:00
Jan-Erik Rediger
8655a6ac7a test: Add regression test for sds argv formatting 2016-05-14 11:26:18 +02:00
Paulino Huerta
360a0646bb Typo format in redisFormatSdsCommandArgv function
this issue is very significant, because not allow the proper execution of the "function redisCommandArgv". The server returns "invalid bulk length".
Thanks!
2016-05-14 01:53:48 +02:00
not-a-robot
e93c05a7aa Auto merge of #378 - thomaslee:tom_fix_kfreebsd, r=badboy
Fix strerror_r on some esoteric platforms

Defining _XOPEN_SOURCE=1 causes strange behavior on Debian kfreebsd archs -- i.e. the GNU userspace with FreeBSD kernel -- when _GNU_SOURCE is not defined (the default).

Not sure I fully understand the bizarre semantics, but it seems to use the XSI-compliant interface (int strerror_r(int, char*, size_t)) but the GNU implementation (char *strerror_r(int, char*, size_t)) such that strerror_r returns 32-bits of a 64-bit char * on x86_64 kfreebsd. We would expect strerror_r to return zero when using the XSI-compliant strerror_r implementation or a 64-bit char* when using the GNU version. Instead, we get something in between!

Unless I'm missing something, being more explicit about what version of _XOPEN_SOURCE we want seems to be the prudent thing to do here -- and if folks want the GNU implementation of strerror_r for some reason they can always -D_GNU_SOURCE explicitly.
2016-05-12 09:44:47 +02:00
not-a-robot
8ef4c472f8 Auto merge of #418 - redis:debug-flags, r=badboy
fix: Rename DEBUG to DEBUG_FLAGS

This avoids issues with environments where DEBUG is set to an arbitrary
value to force debug mode in other tools.

BREAKING CHANGE: This breaks builds that explicitely set `DEBUG` to
                 some value (even the empty value).
                 To get back the old behaviour change the `DEBUG_FLAGS`
                 variable now.

Cloes #381
2016-04-20 18:49:22 +02:00
Jan-Erik Rediger
0616677c93 docs: Add breaking change note about makefile variable 2016-04-20 18:48:39 +02:00
Jan-Erik Rediger
acf8950041 fix: Rename DEBUG to DEBUG_FLAGS
This avoids issues with environments where DEBUG is set to an arbitrary
value to force debug mode in other tools.

BREAKING CHANGE: This breaks builds that explicitely set `DEBUG` to
                 some value (even the empty value).
                 To get back the old behaviour change the `DEBUG_FLAGS`
                 variable now.
2016-04-20 18:46:35 +02:00
not-a-robot
81e8176bac Auto merge of #417 - redis:thread-safety, r=badboy
docs: Note about thread-safety
2016-04-20 18:31:34 +02:00
not-a-robot
35a16d6f69 Auto merge of #416 - redis:string-len-size_t, r=badboy
fix: Change string length type to size_t
2016-04-20 18:17:33 +02:00
not-a-robot
278745d840 Auto merge of #415 - redis:new-readme, r=badboy
docs: Add changelog for upcoming version and note about status of README
2016-04-20 17:55:43 +02:00
Jan-Erik Rediger
b2213b7643 docs: Note about thread-safety 2016-04-20 17:49:20 +02:00
not-a-robot
a91afd746b Auto merge of #379 - thomaslee:tom_test_race, r=badboy
Fix potential race in 'invalid timeout' tests

It's possible for the call to connect() to succeed on the very first try, in which case the logic for checking for invalid timeout fields is never executed. When this happens, the tests fail because they expect a REDIS_ERR_IO but no such failure has occurred.

Tests aside, this is a potential source of irritating and hard-to-find intermittent bugs.

This patch forces the validation to occur early so that we get predictable behavior whenever an invalid timeout is specified.
2016-04-20 17:42:04 +02:00
not-a-robot
d3c7df33a1 Auto merge of #406 - DongwenHuang:patch-1, r=badboy
Update read.c

static char *seekNewline(char *s, size_t len)  :
this function can not parse the string,such as "hello world\r". the case that  the last char is '\r'.
2016-04-20 17:24:30 +02:00
not-a-robot
be2c4272c4 Auto merge of #413 - charsyam:feature/remove-unused-code, r=badboy
remove unnecessory code

remove some  unnecessory code. It is not used any other parts
2016-04-20 17:07:21 +02:00
Jan-Erik Rediger
dba8e32f3e docs: Add changelog for upcoming version and note about status of README
[ci-skip]
2016-04-20 17:01:17 +02:00
Jan-Erik Rediger
97ac0d1f50 fix: Change string length type to size_t 2016-04-20 17:00:14 +02:00
not-a-robot
f201e79bf4 Auto merge of #411 - redis:backwards-compatibility-macros, r=badboy
fix: Remove backwards compatibility macro's

Closes #296

BREAKING CHANGE: This removes the redisReplyReader* functions, which are
                 already replaced by redisReader* functions.
                 It renames `redisReplyReaderSetPrivdata`,
                 `redisReplyReaderGetObject` and `redisReplyReaderGetError`
                 to `redisReaderSetPrivdata`, `redisReaderGetObject`
                 and `redisReaderGetError`.
2016-04-20 16:54:36 +02:00
charsyam
f51fdfb7af remove unnessory code 2016-04-20 23:49:42 +09:00
not-a-robot
92d0e23661 Auto merge of #414 - redis:fix-cygwin, r=badboy
Fix cygwin
2016-04-20 16:44:15 +02:00
not-a-robot
2e11f0c892 Auto merge of #410 - redis:updated-sds, r=badboy
Updated sds
2016-04-20 16:24:57 +02:00
charsyam
921e1aa84b remove unused code 2016-04-20 23:15:41 +09:00
Jan-Erik Rediger
3cba03237e chore: Cleanup appveyor configuration 2016-04-20 16:11:59 +02:00
owent
6c3e40cc8c remove werror in cygwin 2016-04-20 16:10:38 +02:00
owent
6c53d6803a Add CI for Windows
- fix macro problem in mingw-gcc
- fix typedef in cygwin
2016-04-20 16:10:02 +02:00
not-a-robot
cec13a9c46 Auto merge of #407 - xor-gate:fix-wundef-warning, r=badboy
fmacros.h: Fix warning when compiled with -Wundef

When compiling with the flag `-Wundef` the following warning is emitted:

```
[ 40%] Building C object CMakeFiles/hiredis-STATIC.dir/read.c.o
In file included from /data/files/users/jerry/github/hiredis/read.c:33:0:
/data/files/users/jerry/github/hiredis/fmacros.h:17:5: warning: "__APPLE__" is not defined [-Wundef]
 #if __APPLE__ && __MACH__
     ^
In file included from /usr/include/string.h:25:0,
                 from /data/files/users/jerry/github/hiredis/read.c:34:
```
2016-04-20 15:52:12 +02:00
Jan-Erik Rediger
8f5265ded3 fix: Remove backwards compatibility macro's
Closes #296

BREAKING CHANGE: This removes the redisReplyReader* functions, which are
                 already replaced by redisReader* functions.
                 It renames `redisReplyReaderSetPrivdata`,
                 `redisReplyReaderGetObject` and `redisReplyReaderGetError`
                 to `redisReaderSetPrivdata`, `redisReaderGetObject`
                 and `redisReaderGetError`.
2016-04-20 15:42:10 +02:00
Jan-Erik Rediger
a72860765f fix: Add sdsalloc.h file 2016-04-20 15:36:51 +02:00
not-a-robot
36bddcf6ed Auto merge of #391 - redis:catch-error-buf-overflow, r=badboy
Prevent buffer overflow when formatting the error

strncat might copy n+1 bytes (n bytes from the source plus a terminating nul byte).
Also strncat appends after the first found nul byte. But all we pass is
a buffer we might not have zeroed out already.

Closes #380
2016-04-20 15:31:23 +02:00
Jan-Erik Rediger
63e1cf0c63 feat: Include latests changes from sds upstream 2016-04-20 15:27:38 +02:00
clark.kang
d76e13b6d5 apply sds from redis 2016-04-20 15:27:11 +02:00