summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>2015-12-18 13:51:00 +1100
committerSam Mendoza-Jonas <sam@mendozajonas.com>2016-02-09 13:39:34 +1100
commit90cd56cb816e7045b41542c119f64b9ee349a6bc (patch)
tree53e1d851fb78315e54ab3750dcb0c79fd40b7c71
parentd9fc4558e66c32834f2a4fdab31010b40f0a88de (diff)
downloadpetitboot-90cd56cb816e7045b41542c119f64b9ee349a6bc.zip
petitboot-90cd56cb816e7045b41542c119f64b9ee349a6bc.tar.gz
ui/common: Only close valid file descriptor
Fixes Coverity defect #30466 Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
-rw-r--r--ui/common/joystick.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/common/joystick.c b/ui/common/joystick.c
index 455ff19..a3d6abd 100644
--- a/ui/common/joystick.c
+++ b/ui/common/joystick.c
@@ -98,8 +98,8 @@ struct pjs *pjs_init(void *ctx, int (*map)(const struct js_event *))
return pjs;
out_err:
- close(pjs->fd);
- pjs->fd = 0;
+ if (pjs->fd >= 0)
+ close(pjs->fd);
talloc_free(pjs);
return NULL;
}
OpenPOWER on IntegriCloud