chiark / gitweb /
bootchart: use safe_atod() rather than strtod()
authorTom Gundersen <teg@jklm.no>
Tue, 16 Sep 2014 16:42:22 +0000 (18:42 +0200)
committerTom Gundersen <teg@jklm.no>
Tue, 16 Sep 2014 16:42:22 +0000 (18:42 +0200)
src/bootchart/store.c

index 2d2ea428fa570804e1c467727c2a6abd4657fe9c..ed46a503c672171e397b933e7f47f6a1f6d76bd7 100644 (file)
@@ -251,6 +251,7 @@ schedstat_next:
                         _cleanup_fclose_ FILE *st = NULL;
                         char t[32];
                         struct ps_struct *parent;
+                        int r;
 
                         ps->next_ps = new0(struct ps_struct, 1);
                         if (!ps->next_ps) {
@@ -310,7 +311,11 @@ schedstat_next:
                         if (!sscanf(m, "%*s %*s %s", t))
                                 continue;
 
-                        ps->starttime = strtod(t, NULL) / 1000.0;
+                        r = safe_atod(t, &ps->starttime);
+                        if (r < 0)
+                                continue;
+
+                        ps->starttime /= 1000.0;
 
                         if (arg_show_cgroup)
                                 /* if this fails, that's OK */