summaryrefslogtreecommitdiff
path: root/trans/hello.c
diff options
context:
space:
mode:
Diffstat (limited to 'trans/hello.c')
-rw-r--r--trans/hello.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/trans/hello.c b/trans/hello.c
index d36ba848..c49feeb2 100644
--- a/trans/hello.c
+++ b/trans/hello.c
@@ -1,5 +1,5 @@
/* hello.c - A trivial single-file translator
- Copyright (C) 1998, 1999,2001,02 Free Software Foundation, Inc.
+ Copyright (C) 1998,1999,2001,02,2006 Free Software Foundation, Inc.
Gordon Matzigkeit <gord@fig.org>, 1999
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -171,19 +171,22 @@ trivfs_S_io_seek (struct trivfs_protid *cred,
op = cred->po->hook;
switch (whence)
{
- case SEEK_SET:
- op->offs = offs; break;
case SEEK_CUR:
- op->offs += offs; break;
+ offs += op->offs;
+ goto check;
case SEEK_END:
- op->offs = contents_len - offs; break;
+ offs += contents_len;
+ case SEEK_SET:
+ check:
+ if (offs >= 0)
+ {
+ *new_offs = op->offs = offs;
+ break;
+ }
default:
err = EINVAL;
}
- if (! err)
- *new_offs = op->offs;
-
return err;
}