]> jfr.im git - solanum.git/blobdiff - libratbox/src/ratbox_lib.c
libratbox: Clean up uses of strcpy().
[solanum.git] / libratbox / src / ratbox_lib.c
index c6aa0de8f646e18e5e411b99a8f0d000951a3933..a8b1bae89bd5848a716fc85bdfec0e54f9a54084 100644 (file)
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
  *  USA
  *
- *  $Id: ratbox_lib.c 26092 2008-09-19 15:13:52Z androsyn $
+ *  $Id: ratbox_lib.c 26282 2008-12-10 20:33:21Z androsyn $
  */
 
 #include <libratbox_config.h>
 #include <ratbox_lib.h>
 #include <commio-int.h>
+#include <commio-ssl.h>
 
 static log_cb *rb_log;
 static restart_cb *rb_restart;
@@ -69,12 +70,6 @@ rb_ctime(const time_t t, char *buf, size_t len)
 #else
        tp = gmtime(&t);
 #endif
-       if(rb_unlikely(tp == NULL))
-       {
-               strcpy(buf, "");
-               return (buf);
-       }
-
        if(buf == NULL)
        {
                p = timex;
@@ -86,6 +81,12 @@ rb_ctime(const time_t t, char *buf, size_t len)
                tlen = len;
        }
 
+       if(rb_unlikely(tp == NULL))
+       {
+               rb_strlcpy(p, "", tlen);
+               return (p);
+       }
+
        rb_snprintf(p, tlen, "%s %s %d %02u:%02u:%02u %d",
                    s_weekdays[tp->tm_wday], s_month[tp->tm_mon],
                    tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec, tp->tm_year + 1900);
@@ -187,7 +188,11 @@ extern const char *libratbox_serno;
 const char *
 rb_lib_version(void)
 {
-       return libratbox_serno;
+       static char version_info[512];
+       char ssl_info[512];
+       rb_get_ssl_info(ssl_info, sizeof(ssl_info));
+       rb_snprintf(version_info, sizeof(version_info), "libratbox version: %s - %s", libratbox_serno, ssl_info);
+       return version_info;
 }
 
 void