cap_server_time: Fix strftime return value check

This commit is contained in:
Simon Arlott 2019-08-31 16:35:19 +01:00
parent 493f729efc
commit eeeb228664
No known key found for this signature in database
GPG key ID: 49BFFEEFD4C3ED53

View file

@ -57,7 +57,7 @@ cap_server_time_process(hook_data *data)
struct timeval tv; struct timeval tv;
if (!rb_gettimeofday(&tv, NULL)) { if (!rb_gettimeofday(&tv, NULL)) {
if (strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S.", gmtime(&tv.tv_sec)) < 0) if (strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S.", gmtime(&tv.tv_sec)) == 0)
return; return;
if (rb_snprintf_append(buf, sizeof(buf), "%03uZ", (int)tv.tv_usec / 1000) < 0) if (rb_snprintf_append(buf, sizeof(buf), "%03uZ", (int)tv.tv_usec / 1000) < 0)