summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdiskfs/io-seek.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/libdiskfs/io-seek.c b/libdiskfs/io-seek.c
index f17bc04b..7a27da1d 100644
--- a/libdiskfs/io-seek.c
+++ b/libdiskfs/io-seek.c
@@ -17,6 +17,7 @@
#include "priv.h"
#include "io_S.h"
+#include <unistd.h>
#define diskfs_readonly 0
@@ -28,26 +29,28 @@ diskfs_S_io_seek (struct protid *cred,
off_t *newoffset)
{
- CHANGE_IP_FIELD (cred,
+ CHANGE_NODE_FIELD (cred,
({
- err = ioserver_get_conch (&np->i_conch);
- if (!err)
- switch (whence)
- {
- case SEEK_SET:
- cred->po->filepointer = offset;
- break;
- case SEEK_CUR:
- cred->po->filepointer += offset;
- break;
- case SEEK_END:
- cred->po->filepointer = (np->dn_stat.st_size
- + offset);
- break;
- default:
- err = EINVAL;
- break;
- }
+ ioserver_get_conch (&np->conch);
+ switch (whence)
+ {
+ case SEEK_SET:
+ err = 0;
+ cred->po->filepointer = offset;
+ break;
+ case SEEK_CUR:
+ err = 0;
+ cred->po->filepointer += offset;
+ break;
+ case SEEK_END:
+ err = 0;
+ cred->po->filepointer = (np->dn_stat.st_size
+ + offset);
+ break;
+ default:
+ err = EINVAL;
+ break;
+ }
*newoffset = cred->po->filepointer;
}));
}