PATCH: Coverity CID 1255748 check return value from stat()

Mikael Magnusson <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
Not doing this would store garbage in dirsav d when . had been deleted,
or otherwise unable to be stat()ed.
---
 Src/utils.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Src/utils.c b/Src/utils.c
index a1d7c8cc2a..2a1d49e5ad 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -7429,8 +7429,7 @@ lchdir(char const *path, struct dirsav *d, int hard)
 #endif
     } else {
 	level = 0;
-	if (!d->dev && !d->ino) {
-	    stat(".", &st1);
+	if (!d->dev && !d->ino && !stat(".", &st1)) {
 	    d->dev = st1.st_dev;
 	    d->ino = st1.st_ino;
 	}
-- 
2.38.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.