--- freem/src/tp_check.c 2025/03/09 19:50:47 1.3 +++ freem/src/tp_check.c 2025/04/13 04:22:43 1.6 @@ -1,5 +1,5 @@ /* - * $Id: tp_check.c,v 1.3 2025/03/09 19:50:47 snw Exp $ + * $Id: tp_check.c,v 1.6 2025/04/13 04:22:43 snw Exp $ * TP global checkpointing code * * @@ -24,6 +24,15 @@ * along with FreeM. If not, see . * * $Log: tp_check.c,v $ + * Revision 1.6 2025/04/13 04:22:43 snw + * Fix snprintf calls + * + * Revision 1.5 2025/04/09 19:52:02 snw + * Eliminate as many warnings as possible while building with -Wall + * + * Revision 1.4 2025/03/22 18:43:54 snw + * Make STRLEN 255 chars and add BIGSTR macro for larger buffers + * * Revision 1.3 2025/03/09 19:50:47 snw * Second phase of REUSE compliance and header reformat * @@ -48,17 +57,14 @@ cptab *cptab_head[TP_MAX_NEST]; cptab *cptab_insert(int tlevel, char *global) { cptab *t; - char mode; - short g_exists; - char *gc_ns; char *gc_pth; gc_ns = (char *) malloc (STRLEN * sizeof (char)); NULLPTRCHK(gc_ns,"cptab_insert"); - gc_pth = (char *) malloc (STRLEN * sizeof (char)); + gc_pth = (char *) malloc (PATHLEN * sizeof (char)); NULLPTRCHK(gc_pth,"cptab_insert"); for (t = cptab_head[tlevel]; t != NULL; t = t->next) { @@ -84,13 +90,13 @@ cptab *cptab_insert(int tlevel, char *gl t->file = (char *) malloc (sizeof (char) * (strlen (gc_pth))); NULLPTRCHK(t->file,"cptab_insert"); - t->cp_file = (char *) malloc (sizeof (char) * STRLEN); + t->cp_file = (char *) malloc (sizeof (char) * PATHLEN); NULLPTRCHK(t->cp_file,"cptab_insert"); strcpy (t->file, gc_pth); stcnv_m2c (t->file); - snprintf (t->cp_file, STRLEN - 1, "%s.%d.%d.chk", t->file, pid, tp_level); + snprintf (t->cp_file, PATHLEN - 1, "%s.%d.%d.chk", t->file, pid, tp_level); free (gc_ns); free (gc_pth); @@ -170,7 +176,6 @@ void cptab_postcommit(int tlevel) { cptab *t; /*char *cmd;*/ - int rc; /* cmd = (char *) malloc (STRLEN * sizeof (char)); @@ -220,6 +225,7 @@ short cptab_rollback(int tlevel) snprintf (cmd, STRLEN - 1, "/bin/cp '%s' '%s'", t->cp_file, t->file); rc = system (cmd); */ + /* TODO: support OS/2 */ rc = cp (t->file, t->cp_file); if (rc != 0) {