X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fcommon%2Fjoystick.c;h=a3d6abd6acc37803809c75f6cbd887336bf54c0f;hp=455ff19b9d759c2f536b0d8c73ff873f3622e19d;hb=211d7eb1de2d3a9cd97846deb9a85a934dae2981;hpb=66bf929fa97fabb70198455f9eec2e9ccf0661fa 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; }