summary refs log tree commit diff
path: root/io/lockf.c
diff options
context:
space:
mode:
Diffstat (limited to 'io/lockf.c')
-rw-r--r--io/lockf.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/io/lockf.c b/io/lockf.c
index 6d5049027f..6e8851bed7 100644
--- a/io/lockf.c
+++ b/io/lockf.c
@@ -31,6 +31,11 @@ lockf (int fd, int cmd, off_t len)
 
   memset ((char *) &fl, '\0', sizeof (fl));
 
+  /* lockf is always relative to the current file position.  */
+  fl.l_whence = SEEK_CUR;
+  fl.l_start = 0;
+  fl.l_len = len;
+
   switch (cmd)
     {
     case F_TEST:
@@ -61,11 +66,5 @@ lockf (int fd, int cmd, off_t len)
       return -1;
     }
 
-  /* lockf is always relative to the current file position.  */
-  fl.l_whence = SEEK_CUR;
-  fl.l_start = 0;
-
-  fl.l_len = len;
-
   return __fcntl (fd, cmd, &fl);
 }