Explicitly check td_trim(td) to detect open(2) flag
authorTomohiro Kusumi <tkusumi@tuxera.com>
Tue, 7 Mar 2017 20:12:58 +0000 (22:12 +0200)
committerJens Axboe <axboe@fb.com>
Fri, 10 Mar 2017 21:43:37 +0000 (14:43 -0700)
This part is a bit complicated due to td's ddir being a bit flag.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
filesetup.c

index 9388bfc94b419e54e670b7410affda94c97ef9ea..fab9c5dec70b844aa40004ef98cc1794234927c3 100644 (file)
@@ -619,7 +619,8 @@ open_again:
                        f->fd = dup(STDIN_FILENO);
                else
                        from_hash = file_lookup_open(f, flags);
-       } else { //td trim
+       } else if (td_trim(td)) {
+               assert(!td_rw(td)); /* should have matched above */
                flags |= O_RDWR;
                from_hash = file_lookup_open(f, flags);
        }