summary refs log tree commit diff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2018-03-26 18:33:49 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2018-04-19 18:19:29 +0800
commitc22e9cc693a6271533740abd9be1bf918a40b0b3 (patch)
tree22b0aee0f1fa8a4083a97f5f72ecc7017aef08f1
parentexpand: Fix glibc glob(3) support (diff)
downloaddash-c22e9cc693a6271533740abd9be1bf918a40b0b3.tar.gz
dash-c22e9cc693a6271533740abd9be1bf918a40b0b3.zip
redir: Fix typo in noclobber code
The noclobber code has a typo in it that causes it to fail.  This
patch fixes it.

Reported-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--src/redir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/redir.c b/src/redir.c
index f96a76b..71b0f77 100644
--- a/src/redir.c
+++ b/src/redir.c
@@ -192,7 +192,7 @@ openredirect(union node *redir)
 			} else if (!S_ISREG(sb.st_mode)) {
 				if ((f = open64(fname, O_WRONLY, 0666)) < 0)
 					goto ecreate;
-				if (fstat64(f, &sb) < 0 && S_ISREG(sb.st_mode)) {
+				if (!fstat64(f, &sb) && S_ISREG(sb.st_mode)) {
 					close(f);
 					errno = EEXIST;
 					goto ecreate;