Return *some* error if we end up trying to seek before the beginning of
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 17 Nov 2011 06:36:32 +0000 (06:36 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 17 Nov 2011 06:36:32 +0000 (06:36 +0000)
the file, so you don't get weird random errors.  EINVAL is as good as
anything.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39896 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/file_wrappers.c

index f8b9b8c8eb550c0d2572c9d8ed62e9d1e17b0624..7baa0abe0799b59721bb3f01e30cb8bf7d4317ae 100644 (file)
@@ -982,7 +982,7 @@ file_seek(FILE_T file, gint64 offset, int whence, int *err)
        if (offset < 0) {
                offset += file->pos;
                if (offset < 0) {                    /* before start of file! */
-                       /* *err = ???; */
+                       *err = EINVAL;
                        return -1;
                }
                /* rewind, then skip to offset */