From f17d89d0851cb55bf51bf66d86792e2b67bb2cfa Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Vauboin Date: Wed, 18 Mar 2020 14:56:27 +0100 Subject: [PATCH] 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 3103c4a02..ff1153ad4 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 */