chiark / gitweb /
util: silence coverity
authorTom Gundersen <teg@jklm.no>
Mon, 29 Sep 2014 12:30:15 +0000 (14:30 +0200)
committerTom Gundersen <teg@jklm.no>
Mon, 29 Sep 2014 18:52:10 +0000 (20:52 +0200)
Make it clear in the code that ignoring a failed safe_ato?() is intentional.

src/shared/util.c

index 30b0364b64cb7e0edf3d7803a7322ac0d758fdb7..ec33fc126321bc011ca360df73acc77cb9de8357 100644 (file)
@@ -3272,8 +3272,13 @@ unsigned columns(void) {
 
         c = 0;
         e = getenv("COLUMNS");
-        if (e)
-                safe_atoi(e, &c);
+        if (e) {
+                int r;
+
+                r = safe_atoi(e, &c);
+                if (r < 0) {}
+                        /* do nothing, we fall back to c = 0 */
+        }
 
         if (c <= 0)
                 c = fd_columns(STDOUT_FILENO);
@@ -3306,8 +3311,13 @@ unsigned lines(void) {
 
         l = 0;
         e = getenv("LINES");
-        if (e)
-                safe_atou(e, &l);
+        if (e) {
+                int r;
+
+                r = safe_atou(e, &l);
+                if (r < 0) {}
+                        /* do nothing, we fall back to l = 0 */
+        }
 
         if (l <= 0)
                 l = fd_lines(STDOUT_FILENO);