Skip to content

Commit 5d5b396

Browse files
committed
gazetteer: fix bug where osm2pgsql would segfault after completing import when it does not have write permission in current directory.
1 parent 401f342 commit 5d5b396

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

output-gazetteer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static void copy_error_data(const char *sql)
207207
{
208208
unsigned int sqlLen = strlen(sql);
209209

210-
fprintf(hLog, "%s", sql);
210+
if (hLog) fprintf(hLog, "%s", sql);
211211

212212
/* Make sure we have an active copy */
213213
if (!CopyErrorActive)
@@ -1025,7 +1025,7 @@ static void gazetteer_out_stop(void)
10251025
/* Stop any active copy */
10261026
stop_copy();
10271027
//stop_error_copy();
1028-
fclose(hLog);
1028+
if (hLog) fclose(hLog);
10291029

10301030
/* Commit transaction */
10311031
pgsql_exec(Connection, PGRES_COMMAND_OK, "COMMIT");

0 commit comments

Comments
 (0)