diff --git a/apps/plugin.c b/apps/plugin.c index 3836d76d28..bd88da6647 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -40,6 +40,7 @@ #include "version.h" #include "storage.h" #include "pcmbuf.h" +#include "errno.h" #if CONFIG_CHARGING #include "power.h" @@ -680,6 +681,7 @@ static const struct plugin_api rockbox_api = { viewportmanager_theme_enable, viewportmanager_theme_undo, #endif + &errno }; int plugin_load(const char* plugin, const void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index 632533cb47..0a9b8a9a50 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -860,6 +860,7 @@ struct plugin_api { struct viewport *viewport); void (*viewportmanager_theme_undo)(enum screen_type screen, bool force_redraw); #endif + int* __errno; }; /* plugin header */ diff --git a/firmware/include/errno.h b/firmware/include/errno.h index 846cd0e339..3a923238fc 100644 --- a/firmware/include/errno.h +++ b/firmware/include/errno.h @@ -10,7 +10,11 @@ #ifndef _SYS_ERRNO_H_ +#ifdef PLUGIN +#define errno (*rb->__errno) +#else extern int errno; +#endif #define EPERM 1 /* Not super-user */ #define ENOENT 2 /* No such file or directory */