]> git.sur5r.net Git - i3/i3/commitdiff
Merge pull request #3005 from stapelberg/tick
authorMichael Stapelberg <stapelberg@users.noreply.github.com>
Sat, 30 Sep 2017 17:16:43 +0000 (10:16 -0700)
committerGitHub <noreply@github.com>
Sat, 30 Sep 2017 17:16:43 +0000 (10:16 -0700)
Implement the tick event

include/all.h
src/config_parser.c
src/util.c

index c26835b90ff07e6de3742175fbd9052a7551388e..ecc875d08298f6b33b8b03340b84c8d1e33266a3 100644 (file)
@@ -28,6 +28,7 @@
 #include <errno.h>
 #include <err.h>
 #include <stdint.h>
+#include <inttypes.h>
 #include <math.h>
 #include <limits.h>
 
index 58a5552ceb27d77d7f267004cf457a636c902fe1..4e66c91109f3f8f37d0dfddbeacc2da6545cb23c 100644 (file)
@@ -764,6 +764,7 @@ static char *migrate_config(char *input, off_t size) {
     wait(&status);
     if (!WIFEXITED(status)) {
         fprintf(stderr, "Child did not terminate normally, using old config file (will lead to broken behaviour)\n");
+        FREE(converted);
         return NULL;
     }
 
@@ -778,6 +779,7 @@ static char *migrate_config(char *input, off_t size) {
             fprintf(stderr, "# i3 config file (v4)\n");
             /* TODO: nag the user with a message to include a hint for i3 in their config file */
         }
+        FREE(converted);
         return NULL;
     }
 
@@ -900,7 +902,9 @@ bool parse_file(const char *f, bool use_nagbar) {
 
     FREE(current_config);
     current_config = scalloc(stbuf.st_size + 1, 1);
-    fread(current_config, 1, stbuf.st_size, fstr);
+    if ((ssize_t)fread(current_config, 1, stbuf.st_size, fstr) != stbuf.st_size) {
+        die("Could not fread: %s\n", strerror(errno));
+    }
     rewind(fstr);
 
     bool invalid_sets = false;
index ba0969c729674aabe3dd04a0ce9614803514f4f7..dc3444f7b6aa950be8b4696896ac55b1cc4033fc 100644 (file)
@@ -500,7 +500,7 @@ ssize_t slurp(const char *path, char **buf) {
     size_t n = fread(*buf, 1, stbuf.st_size, f);
     fclose(f);
     if ((ssize_t)n != stbuf.st_size) {
-        ELOG("File \"%s\" could not be read entirely: got %zd, want %zd\n", path, n, stbuf.st_size);
+        ELOG("File \"%s\" could not be read entirely: got %zd, want %" PRIi64 "\n", path, n, (int64_t)stbuf.st_size);
         free(*buf);
         *buf = NULL;
         return -1;