]> git.saurik.com Git - redis.git/blobdiff - src/t_hash.c
Fix adding bulk reply when getcwd fails
[redis.git] / src / t_hash.c
index 5e7525bd13a383f38dc54f1420783c01a4acaf64..83ca5b2754c3fce9d9e9bede7e1a1d95e90ba7f2 100644 (file)
@@ -396,17 +396,25 @@ void hmgetCommand(redisClient *c) {
 
 void hdelCommand(redisClient *c) {
     robj *o;
 
 void hdelCommand(redisClient *c) {
     robj *o;
+    int j, deleted = 0;
+
     if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
         checkType(c,o,REDIS_HASH)) return;
 
     if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
         checkType(c,o,REDIS_HASH)) return;
 
-    if (hashTypeDelete(o,c->argv[2])) {
-        if (hashTypeLength(o) == 0) dbDelete(c->db,c->argv[1]);
-        addReply(c,shared.cone);
+    for (j = 2; j < c->argc; j++) {
+        if (hashTypeDelete(o,c->argv[j])) {
+            deleted++;
+            if (hashTypeLength(o) == 0) {
+                dbDelete(c->db,c->argv[1]);
+                break;
+            }
+        }
+    }
+    if (deleted) {
         signalModifiedKey(c->db,c->argv[1]);
         signalModifiedKey(c->db,c->argv[1]);
-        server.dirty++;
-    } else {
-        addReply(c,shared.czero);
+        server.dirty += deleted;
     }
     }
+    addReplyLongLong(c,deleted);
 }
 
 void hlenCommand(redisClient *c) {
 }
 
 void hlenCommand(redisClient *c) {