summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-05-10 18:43:07 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-05-11 14:33:11 +0900
commitc37f7963b141eec9f37115fecb19c8ebfa89b9fb (patch)
tree04b5a04076ce97ac19f6e836f5bb7dd9f68a7da5
parent7eea910d240e58b83b28f106cebb545e898543b5 (diff)
downloadsystemd-c37f7963b141eec9f37115fecb19c8ebfa89b9fb.tar.gz
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.
-rw-r--r--src/basic/unit-def.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/basic/unit-def.h b/src/basic/unit-def.h
index 508b4c504d..c30135f4d6 100644
--- a/src/basic/unit-def.h
+++ b/src/basic/unit-def.h
@@ -3,6 +3,7 @@
#include <stdbool.h>
+#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 {