summaryrefslogtreecommitdiff
path: root/mysys/my_seek.c
diff options
context:
space:
mode:
authorunknown <thek@kpdesk.mysql.com>2006-10-31 09:26:16 +0100
committerunknown <thek@kpdesk.mysql.com>2006-10-31 09:26:16 +0100
commit23061beb737204c79ba4027f354a9afe4aa93a3c (patch)
treeb2d88349ef7e2524023ae7c58023a5574a064456 /mysys/my_seek.c
parent418ae41b4867e53e770d79f66e6d9ba3f7b8974b (diff)
downloadmariadb-git-23061beb737204c79ba4027f354a9afe4aa93a3c.tar.gz
Bug#22828 _my_b_read() ignores return values for my_seek() calls
- Because my_seek actually is capable of returning an error code we should exploit that in the best possible way. - There might be kernel errors or other errors we can't predict and capturing the return value of all system calls gives us better understanding of possible errors. mysys/mf_iocache.c: - Added check on return value for my_seek - Added comments mysys/my_chsize.c: - Added check on return value for my_seek - Added comments mysys/my_lock.c: - Added check on return value for my_seek - Added comments mysys/my_seek.c: - Added comments
Diffstat (limited to 'mysys/my_seek.c')
-rw-r--r--mysys/my_seek.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/mysys/my_seek.c b/mysys/my_seek.c
index 6af65d70fd0..a9ae68cd5f0 100644
--- a/mysys/my_seek.c
+++ b/mysys/my_seek.c
@@ -16,8 +16,30 @@
#include "mysys_priv.h"
- /* Seek to position in file */
- /*ARGSUSED*/
+/*
+ Seek to a position in a file.
+
+ ARGUMENTS
+ File fd The file descriptor
+ my_off_t pos The expected position (absolute or relative)
+ int whence A direction parameter and one of
+ {SEEK_SET, SEEK_CUR, SEEK_END}
+ myf MyFlags Not used.
+
+ DESCRIPTION
+ The my_seek function is a wrapper around the system call lseek and
+ repositions the offset of the file descriptor fd to the argument
+ offset according to the directive whence as follows:
+ SEEK_SET The offset is set to offset bytes.
+ SEEK_CUR The offset is set to its current location plus offset bytes
+ SEEK_END The offset is set to the size of the file plus offset bytes
+
+ RETURN VALUE
+ my_off_t newpos The new position in the file.
+ MY_FILEPOS_ERROR An error was encountered while performing
+ the seek. my_errno is set to indicate the
+ actual error.
+*/
my_off_t my_seek(File fd, my_off_t pos, int whence,
myf MyFlags __attribute__((unused)))