You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/02/25 07:42:15 UTC

[incubator-nuttx] 02/02: libs/libc/modlib/modlib_init.c: initialize file descriptor with -1

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 542574acd61033e92f46ebe15c7d5d8991740b80
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Feb 25 13:54:44 2021 +0900

    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 4b14196..aa1b0f6 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. */