]> git.saurik.com Git - redis.git/blobdiff - src/db.c
Use fstat to detect if stdin was redirected
[redis.git] / src / db.c
index 0dec95b1c5763a8ecea00b2a469cebf14ce5ffb4..6d287d72c914762eef4ec17eb08a2f324df71e58 100644 (file)
--- a/src/db.c
+++ b/src/db.c
@@ -514,15 +514,14 @@ void expireatCommand(redisClient *c) {
 }
 
 void ttlCommand(redisClient *c) {
-    time_t expire;
-    int ttl = -1;
+    time_t expire, ttl = -1;
 
     expire = getExpire(c->db,c->argv[1]);
     if (expire != -1) {
-        ttl = (int) (expire-time(NULL));
+        ttl = (expire-time(NULL));
         if (ttl < 0) ttl = -1;
     }
-    addReplySds(c,sdscatprintf(sdsempty(),":%d\r\n",ttl));
+    addReplyLongLong(c,(long long)ttl);
 }
 
 void persistCommand(redisClient *c) {