summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Bürk <admin@airblader.de>2018-11-08 07:01:23 +0000
committerGitHub <noreply@github.com>2018-11-08 07:01:23 +0000
commit226cb229f702d02954e7ce77c995ab2158a2f869 (patch)
tree12fbb280dad421ac3e20d240e62933aceff344bc
parent1492868b80eb1092b9ccb974fa6792e10dbc7361 (diff)
parentbc5cc6f23820b5d997baa9a3d7473c9a3e0e1a38 (diff)
Merge pull request #320 from eplanet/fix-error-msg
Fix error messages
-rw-r--r--i3status.c2
-rw-r--r--src/print_cpu_usage.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/i3status.c b/i3status.c
index b83b1f3..da4bc78 100644
--- a/i3status.c
+++ b/i3status.c
@@ -666,7 +666,7 @@ int main(int argc, char *argv[]) {
while (1) {
if (exit_upon_signal) {
- fprintf(stderr, "Exiting due to signal.\n");
+ fprintf(stderr, "i3status: exiting due to signal.\n");
exit(1);
}
struct timeval tv;
diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c
index 2549043..faac920 100644
--- a/src/print_cpu_usage.c
+++ b/src/print_cpu_usage.c
@@ -165,8 +165,10 @@ void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format, const
else if (BEGINS_WITH(walk + 1, "cpu")) {
int number = -1;
sscanf(walk + 1, "cpu%d", &number);
- if (number < 0 || number >= cpu_count) {
- fprintf(stderr, "provided CPU number '%d' above detected number of CPU %d\n", number, cpu_count);
+ if (number == -1) {
+ fprintf(stderr, "i3status: provided CPU number cannot be parsed\n");
+ } else if (number >= cpu_count) {
+ fprintf(stderr, "i3status: provided CPU number '%d' above detected number of CPU %d\n", number, cpu_count);
} else {
int cpu_diff_idle = curr_cpus[number].idle - prev_cpus[number].idle;
int cpu_diff_total = curr_cpus[number].total - prev_cpus[number].total;