Is it a bug in V2_open_old()?

Yu-Mei Shaw madeline at
Sun May 15 23:20:06 EDT 1994

We're currently developing an application on Grass, and we ran into a
problem with the limitation of the number of raster files opened,
which limitation was imposed in the G__open_cell_new() library call.
Then, we traced into the V2_open_old() from Vect_open_old(), and found
out that V2_open_old() returned to G__open_cell_new() without closing
the file pointer map->dig_fp after it.  Thus, the number of opened
file pointer would keep accumulating, and reach the limitation of
MAXFILES in G__open_cell_new() soon.  We tried to fix the problem by
adding two lines in V2_open_old() as followed:

    if ((plusfp = fopen (file, RW_str)) != NULL)
        fclose (plusfp);
        have_plus = 1;
        fclose(map->dig_fp);    <<- newly added
        map->dig_fp=NULL;       <<- newly added
        return ("Cannot open dig_plus file");

We don't know if it's been ignored on purpose or not.  Is there
anyone who has the same doubt, or anyone who could tell us the reason
not to modify V2_open_old() as we did?  Thanks!

Best regards
Yu-Mei Shaw
Institute of Information
Academia Sinica

Email: madeline at

More information about the grass-dev mailing list