ash: redir: Fix typo in noclobber code
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 2 Apr 2018 11:34:57 +0000 (13:34 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 2 Apr 2018 11:34:57 +0000 (13:34 +0200)
Upstream commit "redir: Fix typo in noclobber code"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c

index 70a278f42e34b37a6c65c805a0e6a3f5b7736fc9..35ea58f3aa361976cce76a7dadd0742db5dbb3dc 100644 (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;