Fix: automatic enum value overwrites existing error code value
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 13 Jan 2020 20:40:15 +0000 (15:40 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 15 Jan 2020 19:54:16 +0000 (14:54 -0500)
Automatic enum value are generated using the last value and
incrementing it. Having backward compat assignation before the
LTTNG_ERR_NR would end up overwriting the error string since the
LTTNG_ERR_NR value would be LTTNG_ERR_PID_NOT_TRACKED + 1.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I4076866a28961fa49eed018e8249d2cd72979a84
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/lttng/lttng-error.h

index bddd39d7835db0d7534ab5a4ab0ca932fa2449ac..ea2d6eb258ae7be583f04cdb4d361bfbe84cc7dc 100644 (file)
@@ -183,11 +183,12 @@ enum lttng_error_code {
        LTTNG_ERR_USER_NOT_FOUND         = 160, /* User not found. */
        LTTNG_ERR_GROUP_NOT_FOUND        = 161, /* Group not found. */
 
+       /* MUST be last element of the manually-assigned section of the enum */
+       LTTNG_ERR_NR,
+
+       /* Backward-compatibility assignments */
        LTTNG_ERR_PID_TRACKED            = LTTNG_ERR_ID_TRACKED, /* Backward compat alias to LTTNG_ERR_ID_TRACKED */
        LTTNG_ERR_PID_NOT_TRACKED        = LTTNG_ERR_ID_NOT_TRACKED, /* Backward compat alias to LTTNG_ERR_ID_NOT_TRACKED */
-
-       /* MUST be last element */
-       LTTNG_ERR_NR,                           /* Last element */
 };
 
 /*
This page took 0.025649 seconds and 4 git commands to generate.