|
@@ -981,14 +981,23 @@ tor_fd_getpos(int fd)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ * If the file is a pipe, do nothing and succeed.
|
|
|
+ **/
|
|
|
int
|
|
|
tor_fd_seekend(int fd)
|
|
|
{
|
|
|
#ifdef _WIN32
|
|
|
return _lseek(fd, 0, SEEK_END) < 0 ? -1 : 0;
|
|
|
#else
|
|
|
- return lseek(fd, 0, SEEK_END) < 0 ? -1 : 0;
|
|
|
+ int rc = lseek(fd, 0, SEEK_END) < 0 ? -1 : 0;
|
|
|
+#ifdef ESPIPE
|
|
|
+
|
|
|
+ * no need to worry. */
|
|
|
+ if (rc < 0 && errno == ESPIPE)
|
|
|
+ rc = 0;
|
|
|
+#endif
|
|
|
+ return rc;
|
|
|
#endif
|
|
|
}
|
|
|
|