Diff for /freem/src/journal.c between versions 1.1 and 1.7

version 1.1, 2025/01/19 02:04:04 version 1.7, 2025/04/13 04:22:43
Line 1 Line 1
 /*  /*
  *                            *   *   $Id$
  *                           * *  
  *                          *   *  
  *                     ***************  
  *                      * *       * *  
  *                       *  MUMPS  *  
  *                      * *       * *  
  *                     ***************  
  *                          *   *  
  *                           * *  
  *                            *  
  *  
  *   journal.c  
  *    Implementation of FreeM journaling   *    Implementation of FreeM journaling
  *   *
  *     *  
  *   Author: Serena Willis <jpw@coherent-logic.com>   *   Author: Serena Willis <snw@coherent-logic.com>
  *    Copyright (C) 1998 MUG Deutschland   *    Copyright (C) 1998 MUG Deutschland
  *    Copyright (C) 2020 Coherent Logic Development LLC   *    Copyright (C) 2020, 2025 Coherent Logic Development LLC
  *   *
  *   *
  *   This file is part of FreeM.   *   This file is part of FreeM.
Line 35 Line 23
  *   You should have received a copy of the GNU Affero Public License   *   You should have received a copy of the GNU Affero Public License
  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.   *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
  *   *
    *   $Log$
    *   Revision 1.7  2025/04/13 04:22:43  snw
    *   Fix snprintf calls
    *
    *   Revision 1.6  2025/04/10 01:24:38  snw
    *   Remove C++ style comments
    *
    *   Revision 1.5  2025/04/03 20:48:14  snw
    *   Improve daemon error diagnostics and bump to 0.63.0-rc3
    *
    *   Revision 1.4  2025/03/09 19:14:25  snw
    *   First phase of REUSE compliance and header reformat
    *
    *
    * SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
    * SPDX-License-Identifier: AGPL-3.0-or-later
  **/   **/
   
 #include <stdio.h>  #include <stdio.h>
Line 93  short jnl_init(char *jnlfile, char *host Line 97  short jnl_init(char *jnlfile, char *host
   
         jnl_desc = open (jnl_file_path, O_CREAT | O_APPEND | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO);          jnl_desc = open (jnl_file_path, O_CREAT | O_APPEND | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO);
   
         if (jnl_desc == -1) jnl_panic ("error creating new journal file");          snprintf (tmsg, sizeof (tmsg) - 1, "error creating new journal file '%s' [errno %d: '%s']", jnl_file_path, errno, strerror (errno));
           if (jnl_desc == -1) jnl_panic (tmsg);
                   
         jnl_lock ();          jnl_lock ();
   
         memcpy (hdr.magic, m, 5);          memcpy (hdr.magic, m, 5);
         hdr.fmt_version = FRM_JNL_VERSION;          hdr.fmt_version = FRM_JNL_VERSION;
         snprintf (hdr.host_triplet, 40, "%s", HOST);          snprintf (hdr.host_triplet, sizeof (hdr.host_triplet) - 1, "%s", HOST);
                   
         if (write (jnl_desc, &hdr, sizeof (jnl_hdr_t)) == -1) {          if (write (jnl_desc, &hdr, sizeof (jnl_hdr_t)) == -1) {
             snprintf (tmsg, 255, "error %d writing to journal file", errno);              snprintf (tmsg, sizeof (tmsg) - 1, "error %d writing to journal file", errno);
             jnl_panic (tmsg);              jnl_panic (tmsg);
         }          }
   
Line 143  short jnl_init(char *jnlfile, char *host Line 148  short jnl_init(char *jnlfile, char *host
   
         }          }
   
         //strncpy (jnl_host_id, hdr.)  
           
         jnl_unlock ();          jnl_unlock ();
   
         close (jnl_desc);          close (jnl_desc);
Line 226  short jnl_ent_write(short action, char * Line 229  short jnl_ent_write(short action, char *
         switch (errno) {          switch (errno) {
   
             case ENOSPC:              case ENOSPC:
                 snprintf (msg, 255, "ran out of disk space while attempting journal write");                  snprintf (msg, sizeof (msg) - 1, "ran out of disk space while attempting journal write");
                 break;                  break;
   
             default:              default:
                 snprintf (msg, 255, strerror (errno));                  snprintf (msg, sizeof (msg) - 1, "%s", strerror (errno));
                 break;                  break;
   
         }          }

Removed from v.1.1  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>