projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
doc: use ASCII in .texi files where UTF-8 isn't needed
[gnulib.git]
/
lib
/
ftell.c
diff --git
a/lib/ftell.c
b/lib/ftell.c
index
e586fdb
..
d5cbccd
100644
(file)
--- a/
lib/ftell.c
+++ b/
lib/ftell.c
@@
-1,5
+1,5
@@
/* An ftell() function that works around platform bugs.
/* An ftell() function that works around platform bugs.
- Copyright (C) 2007
, 2008
Free Software Foundation, Inc.
+ Copyright (C) 2007
-2014
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 published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-20,21
+20,15
@@
#include <stdio.h>
#include <errno.h>
#include <stdio.h>
#include <errno.h>
-/* Get off_t. */
-#include <unistd.h>
-
-/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
-#ifndef EOVERFLOW
-# define EOVERFLOW E2BIG
-#endif
+#include <limits.h>
long
ftell (FILE *fp)
{
/* Use the replacement ftello function with all its workarounds. */
off_t offset = ftello (fp);
long
ftell (FILE *fp)
{
/* Use the replacement ftello function with all its workarounds. */
off_t offset = ftello (fp);
- if (
offset == (long)offset
)
- return
(long)
offset;
+ if (
LONG_MIN <= offset && offset <= LONG_MAX
)
+ return
/* (long) */
offset;
else
{
errno = EOVERFLOW;
else
{
errno = EOVERFLOW;