[klibc] [klibc:update-dash] dash: redir: Fix typo in noclobber code
klibc-bot for Herbert Xu
herbert at gondor.apana.org.au
Sat Mar 28 14:49:07 PDT 2020
Commit-ID: 4265f8d559e294cc39afce8cc6849341db751b0b
Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=4265f8d559e294cc39afce8cc6849341db751b0b
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: Sat, 28 Mar 2020 21:42:54 +0000
[klibc] dash: redir: Fix typo in noclobber code
[ dash commit c22e9cc693a6271533740abd9be1bf918a40b0b3 ]
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;
More information about the klibc
mailing list