[pgrouting-users] Server Crash in debug code in BiDirAStar.cpp in dev branch

If you compile the BiDirAStar with the DEBUG enabled

The following block of code is switched in (lines 33-39)
#define DBG(format, arg...) \
     dbg = fopen("/tmp/sew-debug", "a"); \
     fprintf(dbg, format, ## arg); \
     fclose(dbg);
#else

If the file /tmp/sew-debug can not be written to, the open will fail, the fprintf on the following line will then be invoked on a null pointer, with the result that program will crash, you need to say something like

#define DBG(format, arg...) \
     dbg = fopen("/tmp/sew-debug", "a"); \
     if(dbg != NULL ){\
         fprintf(dbg, format, ## arg); \
         fclose(dbg);\
     }
#else

On 8/13/2013 5:13 PM, Dave Potts wrote:

If you compile the BiDirAStar with the DEBUG enabled

The following block of code is switched in (lines 33-39)
#define DBG(format, arg...) \
     dbg = fopen("/tmp/sew-debug", "a"); \
     fprintf(dbg, format, ## arg); \
     fclose(dbg);
#else

If the file /tmp/sew-debug can not be written to, the open will fail,
the fprintf on the following line will then be invoked on a null
pointer, with the result that program will crash, you need to say
something like

#define DBG(format, arg...) \
     dbg = fopen("/tmp/sew-debug", "a"); \
     if(dbg != NULL ){\
         fprintf(dbg, format, ## arg); \
         fclose(dbg);\
     }
#else
_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

Dave,

Thanks! good catch on that. I will make that change and push it soon.

-Steve