--- freem/src/tp_check.c 2025/04/09 19:52:02 1.5
+++ freem/src/tp_check.c 2025/04/13 15:12:21 1.7
@@ -1,5 +1,5 @@
/*
- * $Id: tp_check.c,v 1.5 2025/04/09 19:52:02 snw Exp $
+ * $Id: tp_check.c,v 1.7 2025/04/13 15:12:21 snw Exp $
* TP global checkpointing code
*
*
@@ -24,6 +24,12 @@
* along with FreeM. If not, see .
*
* $Log: tp_check.c,v $
+ * Revision 1.7 2025/04/13 15:12:21 snw
+ * Fix transaction checkpoints on OS/2 [CLOSES #34]
+ *
+ * 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
*
@@ -47,6 +53,10 @@
#include "journal.h"
#include "fs.h"
+#if defined(__OS2__)
+# include
+#endif
+
short frm_global_exists(char *, char *, char *);
cptab *cptab_head[TP_MAX_NEST];
@@ -93,7 +103,7 @@ cptab *cptab_insert(int tlevel, char *gl
strcpy (t->file, gc_pth);
stcnv_m2c (t->file);
- snprintf (t->cp_file, PATHLEN, "%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);
@@ -197,44 +207,28 @@ void cptab_postcommit(int tlevel)
short cptab_rollback(int tlevel)
{
cptab *t;
- /*char *cmd;*/
int rc;
- /*
- cmd = (char *) malloc (STRLEN * sizeof (char));
- NULLPTRCHK(cmd,"cptab_rollback");
- */
-
for (t = cptab_head[tlevel]; t != NULL; t = t->next) {
switch (t->mode) {
case CP_REMOVE:
unlink (t->file);
- /*
- snprintf (cmd, STRLEN - 1, "/bin/rm -f '%s'", t->file);
- rc = system (cmd);
- */
break;
case CP_RESTORE:
- /*
- snprintf (cmd, STRLEN - 1, "/bin/cp '%s' '%s'", t->cp_file, t->file);
- rc = system (cmd);
- */
+#if !defined(__OS2__)
rc = cp (t->file, t->cp_file);
-
+#else
+ rc = DosCopy (t->cp_file, t->file, 1);
+#endif
if (rc != 0) {
cptab_head[tlevel] = NULL;
/*free (cmd);*/
return FALSE;
}
- /*
- snprintf (cmd, STRLEN - 1, "/bin/rm -f %s", t->cp_file);
- rc = system (cmd);
- */
-
unlink (t->cp_file);
if (rc != 0) {
cptab_head[tlevel] = NULL;