mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Avoid assert failure when our cached-routers file is empty on startup.
(reported by revstray) svn:r8928
This commit is contained in:
@@ -7,10 +7,12 @@ Changes in version 0.1.2.4-alpha - 2006-11-??
|
||||
don't recognize; it's probably just from a newer version of Tor.
|
||||
- Have directory authorities allow larger amounts of drift in uptime
|
||||
without replacing the server descriptor: previously, a server that
|
||||
restarted every 30 minutes could have 48 "interesting" descriptors per
|
||||
day.
|
||||
restarted every 30 minutes could have 48 "interesting" descriptors
|
||||
per day.
|
||||
- Start linking to the Tor specification and Tor reference manual
|
||||
correctly in the Windows installer.
|
||||
- Avoid assert failure when our cached-routers file is empty on
|
||||
startup.
|
||||
|
||||
|
||||
Changes in version 0.1.2.3-alpha - 2006-10-29
|
||||
|
||||
@@ -141,6 +141,13 @@ tor_mmap_file(const char *filename)
|
||||
page_size = getpagesize();
|
||||
size += (size%page_size) ? page_size-(size%page_size) : 0;
|
||||
|
||||
if (!size) {
|
||||
/* zero-length file. if we call mmap on it, we'll end up setting
|
||||
* data to NULL below, and bad things will happen. So just fail. */
|
||||
log_notice(LD_FS,"File \"%s\" is empty. Ignoring.",filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
string = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (string == MAP_FAILED) {
|
||||
close(fd);
|
||||
|
||||
Reference in New Issue
Block a user