locktest: don't assume that F_OPEN should use O_RDWR
authorJeff Layton <jlayton@poochiereds.net>
Tue, 13 May 2014 05:30:18 +0000 (15:30 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 13 May 2014 05:30:18 +0000 (15:30 +1000)
commit2baab36b5945c5bbc0aeeda490895a5688a01bf5
tree022efecee62e48d0dbf8dd74f15f5b5ca4e5a7f1
parentb6689ad6a50a8e0b1e745637ad7f28982879ed6c
locktest: don't assume that F_OPEN should use O_RDWR

In a later patch, I'll be adding a test for F_GETLK that will require
that we open the file with a different f_mode. Change do_open not to
assume that the it needs to open the file O_RDWR.

While we're at it, fix a bug in do_open. Just because we pass in '0' for
the flags, doesn't mean that this is the initial open.  Move the exit(1)
for that case to the caller.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
src/locktest.c