Author: poeml Date: Wed Jan 29 22:17:37 2014 New Revision: 8344 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8344&view=rev Log: tools/geoiplookup_*: don't segfault when opening a GeoIP database file fails. Patch courtesy of Dagobert Michelsen. (issue #138) Modified: trunk/tools/geoiplookup_city.c trunk/tools/geoiplookup_continent.c Modified: trunk/tools/geoiplookup_city.c URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/tools/geoiplookup_city.c?rev=8344&r1=8343&r2=8344&view=diff ============================================================================== --- trunk/tools/geoiplookup_city.c (original) +++ trunk/tools/geoiplookup_city.c Wed Jan 29 22:17:37 2014 _at_@ -58,6 +58,10 @@ } gip = GeoIP_open(geoipfilename, GEOIP_STANDARD); + if (gip == NULL) { + printf("An error occured during GeoIP_open\n"); + return 1; + } edition = GeoIP_database_edition(gip); if (edition == GEOIP_COUNTRY_EDITION) { Modified: trunk/tools/geoiplookup_continent.c URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/tools/geoiplookup_continent.c?rev=8344&r1=8343&r2=8344&view=diff ============================================================================== --- trunk/tools/geoiplookup_continent.c (original) +++ trunk/tools/geoiplookup_continent.c Wed Jan 29 22:17:37 2014 _at_@ -56,6 +56,10 @@ } gip = GeoIP_open(geoipfilename, GEOIP_STANDARD); + if (gip == NULL) { + printf("An error occured during GeoIP_open\n"); + return 1; + } edition = GeoIP_database_edition(gip); if (edition == GEOIP_COUNTRY_EDITION) { _______________________________________________ mirrorbrain-commits mailing list Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/ Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on Wed Jan 29 2014 - 21:17:41 GMT
This archive was generated by hypermail 2.3.0 : Wed Jan 29 2014 - 21:32:04 GMT