[GRASS-dev] small bug in i.ortho.photo/photo.rectify

hermann schwaerzler hermann.schwaerzler at chello.at
Wed Dec 12 16:17:49 EST 2007


hello

recently I orthorectified some photos using i.ortho.photo. the source 
images are true-colour thus I had three "sub-images" in the 
imegary-group. in the final step I selected all three to rectify them.

after the rectification of the first image the following error occurred:
"ERROR: error while writing to temp file: No such file or directory"
and the second and third images were not rectified.

checking out the cvs-version I found the corresponding bug in 
imagery/i.ortho.photo/photo.rectify/write.c

in function "write_map" (line 63) the temp file-descriptor gets closed 
but not "uninitialized". thus for the second image the check in 
"write_matrix" line 15 finds a non-zero temp_fd which is connected to a 
closed and deleted file. the reuse of this file-descriptor causes the error.

I solved this problem using the following patch:
--- grass6/imagery/i.ortho.photo/photo.rectify/write.c.orig
+++ grass6/imagery/i.ortho.photo/photo.rectify/write.c
@@ -60,7 +60,7 @@
            unlink(temp_name);
         }
     }
-   close(temp_fd);
+   close(temp_fd); temp_fd = 0;
     unlink(temp_name);
     G_close_cell(fd);

it sets the file-descriptor to 0 after closing it in order to make the 
check in line 15 work for any following iterations. probably not the 
best solution as 0 is a valid value for a file-descriptor (normally 
stdin iirc)?

regards
hermann


More information about the grass-dev mailing list