X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fcommon%2Fjoystick.c;h=a3d6abd6acc37803809c75f6cbd887336bf54c0f;hp=4faf8b6248ab09ee1d1bac901d4efa7cb068de2e;hb=454f924bbcda7904c4348ef45c3d0d293768a48c;hpb=089d0a6eb769d531129a7cd1061493a1a24b4bef diff --git a/ui/common/joystick.c b/ui/common/joystick.c index 4faf8b6..a3d6abd 100644 --- a/ui/common/joystick.c +++ b/ui/common/joystick.c @@ -20,7 +20,6 @@ #include "config.h" #endif -#define _GNU_SOURCE #include #include #include @@ -99,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; }