klibc-bot for Herbert Xu
2019-Jan-25  03:15 UTC
[klibc] [klibc:update-dash] redir: Fix typo in noclobber code
Commit-ID:  d1596f8b90d41f5382d6550c03826bed0ce82ffa
Gitweb:    
http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=d1596f8b90d41f5382d6550c03826bed0ce82ffa
Author:     Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Mon, 26 Mar 2018 18:33:49 +0800
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Fri, 25 Jan 2019 02:57:21 +0000
[klibc] 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 at googlemail.com>
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
 usr/dash/redir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/dash/redir.c b/usr/dash/redir.c
index f96a76bc..71b0f774 100644
--- a/usr/dash/redir.c
+++ b/usr/dash/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;
Seemingly Similar Threads
- [klibc:update-dash] dash: redir: Fix typo in noclobber code
- [klibc:update-dash] dash: redir: Handle nested exec within REALLY_CLOSED redirection
- [git patch] klibc dash 0.5.4 update
- When a shell says no (clobber) it means maybe.
- [klibc:update-dash] dash: parser: Fix old-style command substitution here-document crash
