I found two code snippets in the segment library (all branches) that look fishy to me:

the first is in relbr6 here
https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/segment/format.c#L135

should
   if (lseek(fd, 0L, SEEK_SET) == (off_t) - 1) {

not be
   if (lseek(fd, 0L, SEEK_SET) == (off_t) -1) {

because I can't see where 1 is subtracted from? Introduced with automated indentation in r32527

the second is in relbr6 here:
https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/segment/format.c#L178

   if ((bytes_wrote = write(fd, &x, sizeof(int)) == sizeof(int)) < 0)

I am missing parentheses somewhere and would rather use

   if ((bytes_wrote = write(fd, &x, sizeof(int))) != sizeof(int))
   G_warning("%s", strerror(errno));

   return (bytes_wrote == sizeof(int));

just to be on the safe side
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to