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

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

commit f17d89d0851cb55bf51bf66d86792e2b67bb2cfa
Author: Pierre-Olivier Vauboin <[email protected]>
AuthorDate: Wed Mar 18 14:56:27 2020 +0100

    examples/slcd: fix priv->fd that was used by slcd_flush before being set
---
 examples/slcd/slcd_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/slcd/slcd_main.c b/examples/slcd/slcd_main.c
index 3103c4a..ff1153a 100644
--- a/examples/slcd/slcd_main.c
+++ b/examples/slcd/slcd_main.c
@@ -267,7 +267,7 @@ int main(int argc, FAR char *argv[])
   printf("Opening %s for read/write access\n", CONFIG_EXAMPLES_SLCD_DEVNAME);
 
   fd = open(CONFIG_EXAMPLES_SLCD_DEVNAME, O_RDWR);
-  if (priv->fd < 0)
+  if (fd < 0)
     {
       printf("Failed to open %s: %d\n", CONFIG_EXAMPLES_SLCD_DEVNAME, errno);
       goto errout;
@@ -286,6 +286,7 @@ int main(int argc, FAR char *argv[])
 #ifdef CONFIG_STDIO_LINEBUFFER
       priv->stream.flush = slcd_flush;
 #endif
+      priv->fd = fd;
 
       /* Get the attributes of the SCLD device */
 

Reply via email to