mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Allow named pipes for our log files.
Closes ticket 12061. Based on a patch from "carlo von lynX" on tor-dev at https://lists.torproject.org/pipermail/tor-dev/2014-April/006705.html
This commit is contained in:
parent
fb762f6db0
commit
a32913d5aa
4
changes/bug12061
Normal file
4
changes/bug12061
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Minor features:
|
||||||
|
- On unix, you can now use named pipes as the target of the Log
|
||||||
|
option, and other options that try to append to files. Closes
|
||||||
|
ticket 12061. Patch from "carlo von lynX".
|
@ -981,14 +981,23 @@ tor_fd_getpos(int fd)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Move <b>fd</b> to the end of the file. Return -1 on error, 0 on success. */
|
/** Move <b>fd</b> to the end of the file. Return -1 on error, 0 on success.
|
||||||
|
* If the file is a pipe, do nothing and succeed.
|
||||||
|
**/
|
||||||
int
|
int
|
||||||
tor_fd_seekend(int fd)
|
tor_fd_seekend(int fd)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return _lseek(fd, 0, SEEK_END) < 0 ? -1 : 0;
|
return _lseek(fd, 0, SEEK_END) < 0 ? -1 : 0;
|
||||||
#else
|
#else
|
||||||
return lseek(fd, 0, SEEK_END) < 0 ? -1 : 0;
|
int rc = lseek(fd, 0, SEEK_END) < 0 ? -1 : 0;
|
||||||
|
#ifdef ESPIPE
|
||||||
|
/* If we get an error and ESPIPE, then it's a pipe or a socket of a fifo:
|
||||||
|
* no need to worry. */
|
||||||
|
if (rc < 0 && errno == ESPIPE)
|
||||||
|
rc = 0;
|
||||||
|
#endif
|
||||||
|
return rc;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user