[systemd-devel] [PATCH 3/3] util : Remove dead code

philippedeswert at gmail.com philippedeswert at gmail.com
Tue Sep 16 14:27:18 PDT 2014


From: Philippe De Swert <philippedeswert at gmail.com>

We only break out of the pre-ceding loop into the rest of the code
if fd is actually >= 0. So the < 0 check will never be true and
not necessary.

Found with Coverity. Fixes: CID#1237577
---
 src/shared/util.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index 61d6680..30b0364 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1878,9 +1878,6 @@ int open_terminal(const char *name, int mode) {
                 c++;
         }
 
-        if (fd < 0)
-                return -errno;
-
         r = isatty(fd);
         if (r < 0) {
                 safe_close(fd);
-- 
1.8.3.2



More information about the systemd-devel mailing list