chiark / gitweb /
bus-proxyd: explicitly address messages to unique and well-known name
[elogind.git] / src / bootchart / svg.c
index 81211995292761140f3a9aa7daf90fd8895d7408..faf377e506e942f729a2b174c72c709bb9923710 100644 (file)
@@ -80,6 +80,8 @@ static void svg_header(void) {
         double h;
         struct list_sample_data *sampledata_last;
 
+        assert(head);
+
         sampledata = head;
         LIST_FIND_TAIL(link, sampledata, head);
         sampledata_last = head;
@@ -160,7 +162,7 @@ static void svg_title(const char *build) {
         char *c;
         FILE *f;
         time_t t;
-        int fd;
+        int fd, r;
         struct utsname uts;
 
         /* grab /proc/cmdline */
@@ -194,7 +196,8 @@ static void svg_title(const char *build) {
 
         /* date */
         t = time(NULL);
-        strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", localtime(&t));
+        r = strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", localtime(&t));
+        assert_se(r > 0);
 
         /* CPU type */
         fd = openat(procfd, "cpuinfo", O_RDONLY);
@@ -879,21 +882,21 @@ static struct ps_struct *get_next_ps(struct ps_struct *ps) {
         return NULL;
 }
 
-static int ps_filter(struct ps_struct *ps) {
+static bool ps_filter(struct ps_struct *ps) {
         if (!arg_filter)
-                return 0;
+                return false;
 
         /* can't draw data when there is only 1 sample (need start + stop) */
         if (ps->first == ps->last)
-                return -1;
+                return true;
 
         /* don't filter kthreadd */
         if (ps->pid == 2)
-                return 0;
+                return false;
 
         /* drop stuff that doesn't use any real CPU time */
         if (ps->total <= 0.001)
-                return -1;
+                return true;
 
         return 0;
 }