X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ui%2Fcommon%2Fjoystick.c;fp=ui%2Fcommon%2Fjoystick.c;h=a3d6abd6acc37803809c75f6cbd887336bf54c0f;hb=90cd56cb816e7045b41542c119f64b9ee349a6bc;hp=455ff19b9d759c2f536b0d8c73ff873f3622e19d;hpb=d9fc4558e66c32834f2a4fdab31010b40f0a88de;p=petitboot 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; }