Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #28 from wedi/remove-die
Browse files Browse the repository at this point in the history
Remove die calls, add source description to error messages.
  • Loading branch information
oschwald committed Nov 11, 2014
2 parents eb2085b + 7b6114b commit 324abc6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/geoip.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ function geoip_open($filename, $flags)
if ($gi->flags & GEOIP_SHARED_MEMORY) {
$gi->shmid = @shmop_open(GEOIP_SHM_KEY, "a", 0, 0);
} else {
$gi->filehandle = fopen($filename, "rb") or die("Can not open $filename\n");
$gi->filehandle = fopen($filename, "rb") or trigger_error("GeoIP API: Can not open $filename\n", E_USER_ERROR);
if ($gi->flags & GEOIP_MEMORY_CACHE) {
$s_array = fstat($gi->filehandle);
$gi->memory_buffer = fread($gi->filehandle, $s_array['size']);
Expand Down Expand Up @@ -1693,7 +1693,7 @@ function _geoip_seek_country_v6($gi, $ipnum)
);
} else {
fseek($gi->filehandle, 2 * $gi->record_length * $offset, SEEK_SET) == 0
or die("fseek failed");
or trigger_error("GeoIP API: fseek failed", E_USER_ERROR);
$buf = fread($gi->filehandle, 2 * $gi->record_length);
}
$x = array(0, 0);
Expand All @@ -1718,7 +1718,7 @@ function _geoip_seek_country_v6($gi, $ipnum)
$offset = $x[0];
}
}
trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR);
trigger_error("GeoIP API: Error traversing database - perhaps it is corrupt?", E_USER_ERROR);
return false;
}

Expand All @@ -1740,7 +1740,7 @@ function _geoip_seek_country($gi, $ipnum)
);
} else {
fseek($gi->filehandle, 2 * $gi->record_length * $offset, SEEK_SET) == 0
or die("fseek failed");
or trigger_error("GeoIP API: fseek failed", E_USER_ERROR);
$buf = fread($gi->filehandle, 2 * $gi->record_length);
}
$x = array(0, 0);
Expand All @@ -1761,7 +1761,7 @@ function _geoip_seek_country($gi, $ipnum)
$offset = $x[0];
}
}
trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR);
trigger_error("GeoIP API: Error traversing database - perhaps it is corrupt?", E_USER_ERROR);
return false;
}

Expand Down

0 comments on commit 324abc6

Please sign in to comment.