From c37f7963b141eec9f37115fecb19c8ebfa89b9fb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 10 May 2021 18:43:07 +0200 Subject: [PATCH] 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. --- src/basic/unit-def.h | 2 ++ 1 file changed, 2 insertions(+) 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 { -- 2.47.3