summaryrefslogtreecommitdiff
path: root/nuttx/fs/fs_lseek.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-14 21:05:40 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-14 21:05:40 +0000
commit3044a5f0f6197f3923c1229ef1974b17284f56df (patch)
tree189259eb60c6bdc6a646e62b0eb684ae5719554d /nuttx/fs/fs_lseek.c
parent3bfb6d9fd94c9f871eecab92a0d550ab66e5042b (diff)
downloadpx4-nuttx-3044a5f0f6197f3923c1229ef1974b17284f56df.tar.gz
px4-nuttx-3044a5f0f6197f3923c1229ef1974b17284f56df.tar.bz2
px4-nuttx-3044a5f0f6197f3923c1229ef1974b17284f56df.zip
Clean-up files in fs/ directory
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4942 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/fs_lseek.c')
-rw-r--r--nuttx/fs/fs_lseek.c79
1 files changed, 40 insertions, 39 deletions
diff --git a/nuttx/fs/fs_lseek.c b/nuttx/fs/fs_lseek.c
index 12c8b1342..c57658434 100644
--- a/nuttx/fs/fs_lseek.c
+++ b/nuttx/fs/fs_lseek.c
@@ -2,7 +2,7 @@
* fs/fs_lseek.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -124,52 +124,53 @@ off_t lseek(int fd, off_t offset, int whence)
if (inode->u.i_ops->seek)
{
- /* Yes, then let it perform the seek */
-
- err = (int)inode->u.i_ops->seek(filep, offset, whence);
- if (err < 0)
- {
- err = -err;
- goto errout;
- }
+ /* Yes, then let it perform the seek */
+
+ err = (int)inode->u.i_ops->seek(filep, offset, whence);
+ if (err < 0)
+ {
+ err = -err;
+ goto errout;
+ }
}
else
{
- /* No... there are a couple of default actions we can take */
-
- switch (whence)
- {
- case SEEK_CUR:
- offset += filep->f_pos;
-
- case SEEK_SET:
- if (offset >= 0)
- {
- filep->f_pos = offset; /* Might be beyond the end-of-file */
- break;
- }
- else
- {
- err = EINVAL;
- goto errout;
- }
- break;
-
- case SEEK_END:
- err = ENOSYS;
- goto errout;
-
- default:
- err = EINVAL;
- goto errout;
- }
+ /* No... there are a couple of default actions we can take */
+
+ switch (whence)
+ {
+ case SEEK_CUR:
+ offset += filep->f_pos;
+
+ case SEEK_SET:
+ if (offset >= 0)
+ {
+ filep->f_pos = offset; /* Might be beyond the end-of-file */
+ break;
+ }
+ else
+ {
+ err = EINVAL;
+ goto errout;
+ }
+ break;
+
+ case SEEK_END:
+ err = ENOSYS;
+ goto errout;
+
+ default:
+ err = EINVAL;
+ goto errout;
+ }
}
}
+
return filep->f_pos;
errout:
- *get_errno_ptr() = err;
+ set_errno(err);
return (off_t)ERROR;
}
-#endif
+#endif