fixed cmd_bans expires time
authorpk910 <philipp@zoelle1.de>
Thu, 15 Sep 2011 22:47:34 +0000 (00:47 +0200)
committerpk910 <philipp@zoelle1.de>
Thu, 15 Sep 2011 22:47:34 +0000 (00:47 +0200)
cmd_neonserv_bans.c
tools.c

index 29aeb6acb328eda4161f3cf172b6861979cd16c5..742489c0028bfe9c21b773c38b4792f78e4dbb3c 100644 (file)
@@ -32,7 +32,7 @@ static CMD_BIND(neonserv_cmd_bans) {
                     table_change_field(table, i+1, 3, get_language_string(user, "NS_USERS_SEEN_NEVER"));
                 with_expire = 1;
             }
-            content[3] = timeToStr(user, (time(0) - atoi(row[3])), 2, expires_str);
+            content[3] = timeToStr(user, (atoi(row[3]) - time(0)), 2, expires_str);
         } else
             content[3] = (with_expire ? get_language_string(user, "NS_USERS_SEEN_NEVER") : NULL);
         content[4] = row[4];
diff --git a/tools.c b/tools.c
index fb74d5b0caf2bf4fd91a01560cc9ecdbc49311af..c42fb128115a0fc0972ceec74c32a0081e58e786 100644 (file)
--- a/tools.c
+++ b/tools.c
@@ -259,7 +259,7 @@ char* timeToStr(struct UserNode *user, int seconds, int items, char *buf) {
             }
             buf[p++] = ' ';
         }
-        buf[p-1] = '\0';
+        buf[(p ? p-1 : 0)] = '\0';
     }
     return buf;
 }