diff options
author | 2017-10-29 17:10:55 +0000 | |
---|---|---|
committer | 2017-10-29 17:10:55 +0000 | |
commit | 89ef3fd3f508197a7b0e1c0b02d285d23851db8e (patch) | |
tree | d788492ea627832c7e30fa40e487571b09394057 | |
parent | This doesn't need the NET_LOCK, everything is protected by a mutex. (diff) | |
download | wireguard-openbsd-89ef3fd3f508197a7b0e1c0b02d285d23851db8e.tar.xz wireguard-openbsd-89ef3fd3f508197a7b0e1c0b02d285d23851db8e.zip |
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@
-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); } /* |