summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/general.c4
-rw-r--r--src/print_battery_info.c7
-rw-r--r--src/print_cpu_temperature.c2
-rw-r--r--src/print_disk_info.c2
-rw-r--r--src/print_mem.c3
-rw-r--r--src/print_volume.c2
-rw-r--r--src/process_runs.c2
7 files changed, 11 insertions, 11 deletions
diff --git a/src/general.c b/src/general.c
index f299a2b..2424cc6 100644
--- a/src/general.c
+++ b/src/general.c
@@ -51,12 +51,10 @@ char *skip_character(char *input, char character, int amount) {
*
*/
void die(const char *fmt, ...) {
- char buffer[512];
va_list ap;
va_start(ap, fmt);
- (void)vsnprintf(buffer, sizeof(buffer), fmt, ap);
+ (void)vfprintf(stderr, fmt, ap);
va_end(ap);
- fprintf(stderr, "%s", buffer);
exit(EXIT_FAILURE);
}
diff --git a/src/print_battery_info.c b/src/print_battery_info.c
index 7a462f7..04b5a25 100644
--- a/src/print_battery_info.c
+++ b/src/print_battery_info.c
@@ -450,14 +450,17 @@ static bool slurp_all_batteries(struct battery_info *batt_info, yajl_gen json_ge
.present_rate = 0,
.status = CS_UNKNOWN,
};
- if (!slurp_battery_info(&batt_buf, json_gen, buffer, i, globbuf.gl_pathv[i], format_down))
+ if (!slurp_battery_info(&batt_buf, json_gen, buffer, i, globbuf.gl_pathv[i], format_down)) {
+ globfree(&globbuf);
+ free(globpath);
return false;
+ }
is_found = true;
add_battery_info(batt_info, &batt_buf);
}
+ globfree(&globbuf);
}
- globfree(&globbuf);
free(globpath);
if (!is_found) {
diff --git a/src/print_cpu_temperature.c b/src/print_cpu_temperature.c
index 431664e..feae3ec 100644
--- a/src/print_cpu_temperature.c
+++ b/src/print_cpu_temperature.c
@@ -223,7 +223,7 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const
asprintf(&thermal_zone, THERMAL_ZONE, zone);
else {
static glob_t globbuf;
- if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0)
+ if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) != 0)
die("glob() failed\n");
if (globbuf.gl_pathc == 0) {
/* No glob matches, the specified path does not contain a wildcard. */
diff --git a/src/print_disk_info.c b/src/print_disk_info.c
index fb73480..770e718 100644
--- a/src/print_disk_info.c
+++ b/src/print_disk_info.c
@@ -7,7 +7,7 @@
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/types.h>
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
#include <sys/param.h>
#include <sys/mount.h>
#elif defined(__NetBSD__)
diff --git a/src/print_mem.c b/src/print_mem.c
index 46523d6..a37fa29 100644
--- a/src/print_mem.c
+++ b/src/print_mem.c
@@ -39,10 +39,9 @@ static int print_bytes_human(char *outwalk, uint64_t bytes) {
*
*/
static long memory_absolute(const long mem_total, const char *size) {
- long mem_absolute = -1;
char *endptr = NULL;
- mem_absolute = strtol(size, &endptr, 10);
+ long mem_absolute = strtol(size, &endptr, 10);
if (endptr) {
while (endptr[0] != '\0' && isspace(endptr[0]))
diff --git a/src/print_volume.c b/src/print_volume.c
index be6a1d7..e28a132 100644
--- a/src/print_volume.c
+++ b/src/print_volume.c
@@ -151,7 +151,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *
snd_mixer_selem_id_set_index(sid, mixer_idx);
snd_mixer_selem_id_set_name(sid, mixer);
if (!(elem = snd_mixer_find_selem(m, sid))) {
- fprintf(stderr, "i3status: ALSA: Cannot find mixer %s (index %i)\n",
+ fprintf(stderr, "i3status: ALSA: Cannot find mixer %s (index %u)\n",
snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
snd_mixer_close(m);
snd_mixer_selem_id_free(sid);
diff --git a/src/process_runs.c b/src/process_runs.c
index b5e8f11..da2dba1 100644
--- a/src/process_runs.c
+++ b/src/process_runs.c
@@ -24,7 +24,7 @@ bool process_runs(const char *path) {
static glob_t globbuf;
memset(pidbuf, 0, sizeof(pidbuf));
- if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0)
+ if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) != 0)
die("glob() failed\n");
if (globbuf.gl_pathc == 0) {
/* No glob matches, the specified path does not contain a wildcard. */