From adbbc1377a0b39cf47d2c96f75916431f6eeed9f Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 8 Apr 2021 12:07:00 +0200 Subject: [PATCH] dtoolutil: Work around odd Linux bug with lseek on a directory fd Fixes #1140 --- src/dtoolutil/pandaFileStreamBuf.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dtoolutil/pandaFileStreamBuf.cxx b/src/dtoolutil/pandaFileStreamBuf.cxx index 676f17e0e66..1caecaf9917 100644 --- a/src/dtoolutil/pandaFileStreamBuf.cxx +++ b/src/dtoolutil/pandaFileStreamBuf.cxx @@ -333,7 +333,7 @@ seekoff(streamoff off, ios_seekdir dir, ios_openmode which) { // Posix case. { off_t li = lseek(_fd, off, SEEK_END); - if (li == (off_t)-1) { + if (li == (off_t)-1 || (sizeof(off_t) == 8 && li == 0x7fffffffffffffff)) { return -1; } new_pos = (size_t)li;