diff options
author | Laslo Hunhold <dev@frign.de> | 2018-05-19 19:33:04 +0200 |
---|---|---|
committer | Aaron Marcher <me@drkhsh.at> | 2018-05-19 19:44:02 +0200 |
commit | 422cadfd5ffd78ae1b8fdf15734e03bd0333b26e (patch) | |
tree | cf243529272e96e3d65b44afecd08cbb9f4e3005 /slstatus.c | |
parent | f31b113e7e85bf7057cb88a70d88c5ce9325e208 (diff) |
Implement esnprintf() and make formatted calls more efficient
Within the components, snprintf() was unchecked and had inefficient
calls in some places.
We implement esnprintf() that does all the dirty laundry for us
and use it exclusively now.
Diffstat (limited to 'slstatus.c')
-rw-r--r-- | slstatus.c | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -91,12 +91,8 @@ main(int argc, char *argv[]) if (!(res = args[i].func(args[i].args))) { res = unknown_str; } - if ((ret = snprintf(status + len, sizeof(status) - len, + if ((ret = esnprintf(status + len, sizeof(status) - len, args[i].fmt, res)) < 0) { - warn("snprintf:"); - break; - } else if ((size_t)ret >= sizeof(status) - len) { - warn("snprintf: Output truncated"); break; } len += ret; |