aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2018-07-18 15:11:20 +0200
committerToni Uhlig <matzeton@googlemail.com>2018-07-18 15:11:20 +0200
commitd761d1c87865b17973c42bab85b221a88043537c (patch)
treecd3b071601e173cb46c7e021d90b25855721a477 /src
parent5402a761ee1299af7c1a8e710998f81e43ad582f (diff)
Coverity CID 301775: check for valid fd before close()
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src')
-rw-r--r--src/utils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index c9a1463..0979622 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -747,7 +747,8 @@ static int cgroups_write_file(const char *cdir, const char *csub,
value, cdir, csub);
s = 1;
}
- close(fd);
+ if (fd >= 0)
+ close(fd);
}
return s;