Skip to content

Commit d104515

Browse files
committed
sudoers_init: initialize ret to -1 if not using the saved value
Otherwise we could end up in a situation where the wrong value is returned when sudoers_init() is called again after sudoers_cleanup() (which sets sudoers_initialized to false).
1 parent bc020f4 commit d104515

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plugins/sudoers/sudoers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,14 @@ sudoers_init(void *info, sudoers_logger_t logger, char * const envp[])
186186
{
187187
struct sudo_nss *nss, *nss_next;
188188
int oldlocale, sources = 0;
189-
static int ret = -1;
189+
static int ret;
190190
debug_decl(sudoers_init, SUDOERS_DEBUG_PLUGIN);
191191

192192
/* Only attempt to initialize once. */
193193
if (sudoers_initialized)
194194
debug_return_int(ret);
195195
sudoers_initialized = true;
196+
ret = -1;
196197

197198
bindtextdomain("sudoers", LOCALEDIR);
198199

0 commit comments

Comments
 (0)