Index: trunk/config.h.in =================================================================== --- trunk/config.h.in (revision 24814) +++ trunk/config.h.in (revision 24815) @@ -274,6 +274,7 @@ # define remove never_use_remove__use_pcb_remove # define rename never_use_rename__use_pcb_rename # define mkdir never_use_mkdir__use_pcb_mkdir +# define unlink never_use_unlink__use_pcb_unlink # define opendir never_use_opendir__use_pcb_opendir # define readdir never_use_readdir__use_pcb_readdir # define closedir never_use_closedir__use_pcb_closedir Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 24814) +++ trunk/scconfig/Rev.h (revision 24815) @@ -1 +1 @@ -static const int myrev = 24814; +static const int myrev = 24815; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 24814) +++ trunk/scconfig/Rev.tab (revision 24815) @@ -1,4 +1,4 @@ -24814 configure safety wrapper around opendir and readdir +24815 configure safety wrapper around unlink, opendir, closedir and readdir 24736 configure make distclean fixes to really remove all generated files 24625 configure io_kicad common layer table code among read and write side 24585 configure io_kicad depends on the shape plugin for round-rect pads Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 24814) +++ trunk/src/plug_io.c (revision 24815) @@ -811,7 +811,7 @@ fclose(fp); if (fn_tmp != NULL) { if ((result == 0) && (!conf_core.rc.keep_save_backups)) - unlink(fn_tmp); + pcb_unlink(fn_tmp); free(fn_tmp); } return result; Index: trunk/src/safe_fs.c =================================================================== --- trunk/src/safe_fs.c (revision 24814) +++ trunk/src/safe_fs.c (revision 24815) @@ -184,6 +184,16 @@ return res; } +int pcb_unlink(const char *path) +{ + int res; + char *path_exp = pcb_build_fn(path); + res = unlink(path_exp); + free(path_exp); + return res; +} + + DIR *pcb_opendir(const char *name) { DIR *d; Index: trunk/src/safe_fs.h =================================================================== --- trunk/src/safe_fs.h (revision 24814) +++ trunk/src/safe_fs.h (revision 24815) @@ -40,6 +40,7 @@ int pcb_remove(const char *path); int pcb_rename(const char *old_path, const char *new_path); int pcb_mkdir(const char *path, int mode); +int pcb_unlink(const char *path); /* Return the size of non-large files; on error or for large files (size larger than the value long can hold) return -1 */ Index: trunk/src_plugins/import_sch/import_sch.c =================================================================== --- trunk/src_plugins/import_sch/import_sch.c (revision 24814) +++ trunk/src_plugins/import_sch/import_sch.c (revision 24815) @@ -50,6 +50,7 @@ #include "misc_util.h" #include "compat_misc.h" #include "obj_rat.h" +#include "safe_fs.h" #ifdef HAVE_UNISTD_H #include @@ -266,7 +267,7 @@ if (pcb_spawnvp(cmd)) { for(i = 0; i < nsources; i++) free((char *) cmd[8 + i]); - unlink(tmpfile); + pcb_unlink(tmpfile); PCB_ACT_IRES(1); return 0; } @@ -343,7 +344,7 @@ if (pcb_spawnvp(cmd)) { if (must_free_tmpfile) - unlink(tmpfile); + pcb_unlink(tmpfile); free((char*)cmd[2]); free((char*)cmd[3]); free((char*)cmd[4]);