summaryrefslogtreecommitdiff
path: root/glib/giounix.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-02-15 16:41:54 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-02-15 16:41:54 +0000
commit5d43b9ade4e632d14f171ea72a7a33de06bf9860 (patch)
treea5b28827982b164e1fa94283f1d619318cb80fb4 /glib/giounix.c
parent9c357424fc4de953afaf2aa09020b825bb5733ab (diff)
downloadglib-5d43b9ade4e632d14f171ea72a7a33de06bf9860.tar.gz
Updated.
Fri Feb 15 10:41:51 2002 Owen Taylor <otaylor@redhat.com> * NEWS: Updated. * configure.in: Require autoconf-2.52, run AC_SYS_LARGEFILE. (#71410, Sven Neumann) * glib/giounix.c glib/giowin32.c glib/giochannel.[ch]: Change offset type for g_io_channel_seek[_position] to gint64.
Diffstat (limited to 'glib/giounix.c')
-rw-r--r--glib/giounix.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/glib/giounix.c b/glib/giounix.c
index bc5211215..826a2e5b4 100644
--- a/glib/giounix.c
+++ b/glib/giounix.c
@@ -31,6 +31,8 @@
* MT safe
*/
+#include "config.h"
+
#include "glib.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -73,7 +75,7 @@ static GIOStatus g_io_unix_write (GIOChannel *channel,
gsize *bytes_written,
GError **err);
static GIOStatus g_io_unix_seek (GIOChannel *channel,
- glong offset,
+ gint64 offset,
GSeekType type,
GError **err);
static GIOStatus g_io_unix_close (GIOChannel *channel,
@@ -251,12 +253,13 @@ g_io_unix_write (GIOChannel *channel,
static GIOStatus
g_io_unix_seek (GIOChannel *channel,
- glong offset,
+ gint64 offset,
GSeekType type,
GError **err)
{
GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel;
int whence;
+ off_t tmp_offset;
off_t result;
switch (type)
@@ -275,7 +278,16 @@ g_io_unix_seek (GIOChannel *channel,
g_assert_not_reached ();
}
- result = lseek (unix_channel->fd, offset, whence);
+ tmp_offset = offset;
+ if (tmp_offset != offset)
+ {
+ g_set_error (err, G_IO_CHANNEL_ERROR,
+ g_io_channel_error_from_errno (EINVAL),
+ strerror (EINVAL));
+ return G_IO_STATUS_ERROR;
+ }
+
+ result = lseek (unix_channel->fd, tmp_offset, whence);
if (result < 0)
{