From 542574acd61033e92f46ebe15c7d5d8991740b80 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 25 Feb 2021 13:54:44 +0900 Subject: [PATCH] libs/libc/modlib/modlib_init.c: initialize file descriptor with -1 Use -1 instead of 0 to represent an invalid descriptor so that modlib_uninitialize doesn't try to close the descriptor 0. --- libs/libc/modlib/modlib_init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/libc/modlib/modlib_init.c b/libs/libc/modlib/modlib_init.c index 4b14196dc8..aa1b0f61ac 100644 --- a/libs/libc/modlib/modlib_init.c +++ b/libs/libc/modlib/modlib_init.c @@ -132,6 +132,7 @@ int modlib_initialize(FAR const char *filename, /* Clear the load info structure */ memset(loadinfo, 0, sizeof(struct mod_loadinfo_s)); + loadinfo->filfd = -1; /* Get the length of the file. */