commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hurd/trans ChangeLog hello-mt.c hello.c


From: Thomas Schwinge
Subject: hurd/trans ChangeLog hello-mt.c hello.c
Date: Thu, 15 Jun 2006 13:52:31 +0000

CVSROOT:        /cvsroot/hurd
Module name:    hurd
Changes by:     Thomas Schwinge <tschwinge>     06/06/15 13:52:31

Modified files:
        trans          : ChangeLog hello-mt.c hello.c 

Log message:
        2006-06-15  Thomas Schwinge  <address@hidden>
        
                * hello-mt.c (trivfs_S_io_seek): Seek into the right direction 
for
                `SEEK_END'.  Return EINVAL if file pointer would become 
negative.
                * hello.c (trivfs_S_io_seek): Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/hurd/trans/ChangeLog?cvsroot=hurd&r1=1.91&r2=1.92
http://cvs.savannah.gnu.org/viewcvs/hurd/trans/hello-mt.c?cvsroot=hurd&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/hurd/trans/hello.c?cvsroot=hurd&r1=1.5&r2=1.6

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/hurd/hurd/trans/ChangeLog,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -b -r1.91 -r1.92
--- ChangeLog   25 Mar 2006 22:20:20 -0000      1.91
+++ ChangeLog   15 Jun 2006 13:52:31 -0000      1.92
@@ -1,3 +1,9 @@
+2006-06-15  Thomas Schwinge  <address@hidden>
+
+       * hello-mt.c (trivfs_S_io_seek): Seek into the right direction for
+       `SEEK_END'.  Return EINVAL if file pointer would become negative.
+       * hello.c (trivfs_S_io_seek): Likewise.
+
 2006-03-25  Thomas Schwinge  <address@hidden>
 
        [bug #15808]

Index: hello-mt.c
===================================================================
RCS file: /cvsroot/hurd/hurd/trans/hello-mt.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- hello-mt.c  13 Jun 2002 21:26:39 -0000      1.4
+++ hello-mt.c  15 Jun 2006 13:52:31 -0000      1.5
@@ -1,5 +1,5 @@
 /* hello-mt.c - A trivial single-file translator, multithreaded version
-   Copyright (C) 1998,99,2001,02 Free Software Foundation, Inc.
+   Copyright (C) 1998,99,2001,02,2006 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -195,19 +195,22 @@
 
   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;
-
   mutex_unlock (&op->lock);
 
   return err;

Index: hello.c
===================================================================
RCS file: /cvsroot/hurd/hurd/trans/hello.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- hello.c     13 Jun 2002 21:26:39 -0000      1.5
+++ hello.c     15 Jun 2006 13:52:31 -0000      1.6
@@ -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 <address@hidden>, 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 @@
   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;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]