I'm trying to SET
a struct into Redis with hiredis:
struct StatLite
{
uid_t uid;
gid_t gid;
mode_t mode;
}
bool RedisPermissionHandler::Set(std::string path, StatLite stat)
{
redisReply *reply = (redisReply*)redisCommand(this->redis,
"SET %b %b",
path.c_str(), (size_t)path.length(),
stat, (size_t)sizeof(stat));
freeReplyObject(reply);
return true;
}
However this runs into a segmentation fault somewhere inside hiredis.
this->redis
, path
, and stat
have proper values. GET
commands work and deliver a NIL reply type (since Redis is empty).
What am I doing wrong?