[brlcad-commits] CVS: brlcad/src/libtclcad tclcadAutoPath.c, 1.16, 1.17
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: Sean M. <br...@us...> - 2007-04-09 12:54:29
|
Update of /cvsroot/brlcad/brlcad/src/libtclcad In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10917/src/libtclcad Modified Files: tclcadAutoPath.c Log Message: use bu_file_exists() instead of Tcl_FSStat() to avoid getting header define/symbol mixups in tcl headers (that seem to be causing a crash at least on some linux due to Tcl_StatBuf getting written past, wrong size) Index: tclcadAutoPath.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/libtclcad/tclcadAutoPath.c,v retrieving revision 1.16 retrieving revision 1.17 diff -w -u -r1.16 -r1.17 --- tclcadAutoPath.c 2 Apr 2007 02:35:32 -0000 1.16 +++ tclcadAutoPath.c 9 Apr 2007 12:54:27 -0000 1.17 @@ -290,12 +290,9 @@ for (srcpath = strtok_r(bu_vls_addr(&auto_path), ":", &stp); srcpath; srcpath = strtok_r(NULL, ":", &stp)) { - Tcl_StatBuf stat; - Tcl_Obj *newpath = Tcl_NewStringObj(srcpath,-1); - Tcl_IncrRefCount(newpath); - /* make sure it exists as a directory before appending */ - if ((0 == Tcl_FSStat(newpath, &stat)) && S_ISDIR(stat.st_mode)) { + /* make sure it exists before appending */ + if (bu_file_exists(srcpath)) { /* printf("APPENDING: %s\n", srcpath); */ bu_vls_sprintf(&lappend, "lappend auto_path \"%s\"", srcpath); (void)Tcl_Eval(interp, bu_vls_addr(&lappend)); @@ -310,7 +307,10 @@ /* these doesn't seem to do what one might expect * here, but call it anyways. */ + Tcl_Obj *newpath = Tcl_NewStringObj(srcpath,-1); + Tcl_IncrRefCount(newpath); TclSetLibraryPath(newpath); + Tcl_DecrRefCount(newpath); /* this really sets it */ snprintf(buffer, MAX_BUF, "set tcl_library \"%s\"", srcpath); @@ -318,7 +318,6 @@ bu_log("Tcl_Eval ERROR:\n%s\n", interp->result); } } - Tcl_DecrRefCount(newpath); } bu_vls_free(&auto_path); |