From: Lennart Poettering Date: Mon, 10 May 2021 16:43:07 +0000 (+0200) Subject: unit-def: ensure UnitType enum fits any errno value X-Git-Tag: v249-rc1~249 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c37f7963b141eec9f37115fecb19c8ebfa89b9fb;p=thirdparty%2Fsystemd.git unit-def: ensure UnitType enum fits any errno value This is a follow-up for #19514 which changed unit_name_to_instance() to return ENOMEM as a UnitType enum, even though the enum didn't necessarily have range for that. Let's extend the range explicitly, so that we can cover the full errno range in it. --- diff --git a/src/basic/unit-def.h b/src/basic/unit-def.h index 508b4c504da..c30135f4d6c 100644 --- a/src/basic/unit-def.h +++ b/src/basic/unit-def.h @@ -3,6 +3,7 @@ #include +#include "errno-list.h" #include "locale-util.h" #include "macro.h" @@ -23,6 +24,7 @@ typedef enum UnitType { UNIT_SCOPE, _UNIT_TYPE_MAX, _UNIT_TYPE_INVALID = -EINVAL, + _UNIT_TYPE_ERRNO_MAX = -ERRNO_MAX, /* Ensure the whole errno range fits into this enum */ } UnitType; typedef enum UnitLoadState {