ash: redir: Fix typo in noclobber code

Upstream commit "redir: Fix typo in noclobber code"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-04-02 13:34:57 +02:00
parent c4c2012284
commit 355ec353be

View File

@ -5391,7 +5391,7 @@ openredirect(union node *redir)
f = open(fname, O_WRONLY, 0666);
if (f < 0)
goto ecreate;
if (fstat(f, &sb) < 0 && S_ISREG(sb.st_mode)) {
if (!fstat(f, &sb) && S_ISREG(sb.st_mode)) {
close(f);
errno = EEXIST;
goto ecreate;