if (f->fd == -1) {
char buf[FIO_VERROR_SIZE];
int __e = errno;
- snprintf(buf, sizeof(buf) - 1, "open(%s)", f->file_name);
+ snprintf(buf, sizeof(buf), "open(%s)", f->file_name);
td_verror(td, __e, buf);
}
if (__e == EMFILE && file_close_shadow_fds(td))
goto open_again;
- snprintf(buf, sizeof(buf) - 1, "open(%s)", f->file_name);
+ snprintf(buf, sizeof(buf), "open(%s)", f->file_name);
if (__e == EINVAL && (flags & OS_O_DIRECT)) {
log_err("fio: looks like your file system does not " \
if (!D) {
char buf[FIO_VERROR_SIZE];
- snprintf(buf, FIO_VERROR_SIZE - 1, "opendir(%s)", dirname);
+ snprintf(buf, FIO_VERROR_SIZE, "opendir(%s)", dirname);
td_verror(td, errno, buf);
return 1;
}
int e = (err); \
(td)->error = e; \
if (!(td)->first_error) \
- snprintf(td->verror, sizeof(td->verror) - 1, "file:%s:%d, func=%s, error=%s", __FILE__, __LINE__, (func), (msg)); \
+ snprintf(td->verror, sizeof(td->verror), "file:%s:%d, func=%s, error=%s", __FILE__, __LINE__, (func), (msg)); \
} while (0)
p++;
} while (*p);
- snprintf(buf, 31, "%u%c", val, *p);
+ snprintf(buf, 32, "%u%c", val, *p);
return buf;
}
{
char file_name[256], *p;
- snprintf(file_name, 200, "%s_%s.log", prefix, postfix);
+ snprintf(file_name, sizeof(file_name), "%s_%s.log", prefix, postfix);
p = basename(file_name);
__finish_log(log, p);
}
size_t len;
len = vsnprintf(buffer, sizeof(buffer), str, args);
+ len = min(len, sizeof(buffer) - 1);
if (log_syslog)
syslog(LOG_INFO, "%s", buffer);
va_start(args, format);
len = vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
+ len = min(len, sizeof(buffer) - 1);
if (log_syslog)
syslog(LOG_INFO, "%s", buffer);
va_start(args, format);
len = vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
+ len = min(len, sizeof(buffer) - 1);
if (is_backend)
return fio_server_text_output(buffer, len);
va_start(args, format);
len = vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
+ len = min(len, sizeof(buffer) - 1);
if (is_backend)
return fio_server_text_output(buffer, len);
va_start(args, format);
len = vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
+ len = min(len, sizeof(buffer) - 1);
return fio_server_text_output(buffer, len);
}
json_object_add_value_int(percentile_object, "0.00", 0);
continue;
}
- snprintf(buf, sizeof(buf) - 1, "%2.2f", ts->percentile_list[i].u.f);
+ snprintf(buf, sizeof(buf), "%2.2f", ts->percentile_list[i].u.f);
json_object_add_value_int(percentile_object, (const char *)buf, ovals[i]);
}
for (i = 0; i < 7; i++) {
char name[20];
if (i < 6)
- snprintf(name, 19, "%d", 1 << i);
+ snprintf(name, 20, "%d", 1 << i);
else
- snprintf(name, 19, ">=%d", 1 << i);
+ snprintf(name, 20, ">=%d", 1 << i);
json_object_add_value_float(tmp, (const char *)name, io_u_dist[i]);
}
va_start(args, format);
len = vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
+ len = min(len, sizeof(buffer) - 1);
return fwrite(buffer, len, 1, stderr);
}
va_start(args, format);
len = vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
+ len = min(len, sizeof(buffer) - 1);
return fwrite(buffer, len, 1, stdout);
}