From f9fa7b56b4bbc72f5856398d1969a4293e663c58 Mon Sep 17 00:00:00 2001 From: wkliao Date: Mon, 12 Feb 2024 19:54:22 -0600 Subject: [PATCH] initialize st_buf.st_mode to silence valgrind warning --- src/drivers/ncmpio/ncmpio_create.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/drivers/ncmpio/ncmpio_create.c b/src/drivers/ncmpio/ncmpio_create.c index 9fcbfbd65..727dec6c2 100644 --- a/src/drivers/ncmpio/ncmpio_create.c +++ b/src/drivers/ncmpio/ncmpio_create.c @@ -84,9 +84,11 @@ ncmpio_create(MPI_Comm comm, /* Check if the file already exists, if lstat() or access() is available */ #ifdef HAVE_LSTAT - struct stat st_buf; /* call lstat() to check the file if exists and if is a symbolic link */ if (rank == 0) { + struct stat st_buf; + st_buf.st_mode = 0; + if (lstat(filename, &st_buf) == -1) file_exist = 0; errno = 0; /* reset errno */