diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-10-29 17:10:56 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-10-29 17:10:56 +0000 |
commit | dfbda203f1909e87dab08f92c7c0bfaad79f4db1 (patch) | |
tree | b4a189842d7291b823059e8583a539d879a38e01 /usr.bin/less/filename.c | |
parent | a9c7839f818efe6a2d3b25b03196eadddd03313c (diff) |
After fstat(2) failure, trying lseek(2) is useless, so delete it.
Based on a smaller diff from Jesper Wallin <jesper at ifconfig dot se>.
OK deraadt@
Diffstat (limited to 'usr.bin/less/filename.c')
-rw-r--r-- | usr.bin/less/filename.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/usr.bin/less/filename.c b/usr.bin/less/filename.c index cb34b690844..00bf8573ce5 100644 --- a/usr.bin/less/filename.c +++ b/usr.bin/less/filename.c @@ -363,20 +363,6 @@ bin_file(int f) } /* - * Try to determine the size of a file by seeking to the end. - */ -static off_t -seek_filesize(int f) -{ - off_t spos; - - spos = lseek(f, (off_t)0, SEEK_END); - if (spos == (off_t)-1) - return (-1); - return (spos); -} - -/* * Read a string from a file. * Return a pointer to the string in memory. */ @@ -742,7 +728,6 @@ bad_file(char *filename) /* * Return the size of a file, as cheaply as possible. - * In Unix, we can stat the file. */ off_t filesize(int f) @@ -751,7 +736,7 @@ filesize(int f) if (fstat(f, &statbuf) >= 0) return (statbuf.st_size); - return (seek_filesize(f)); + return (-1); } /* |