systemd/0424-util-silence-coverity.patch
Zbigniew Jędrzejewski-Szmek 62fe9450da Update to latest git
2014-10-07 15:51:56 -04:00

47 lines
1.3 KiB
Diff

From 9fb02b1d5df153aa522256aec821e422cca7f284 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Mon, 29 Sep 2014 14:30:15 +0200
Subject: [PATCH] util: silence coverity
Make it clear in the code that ignoring a failed safe_ato?() is intentional.
---
src/shared/util.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index 30b0364b64..ec33fc1263 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -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);