From: Larry Moore Subject: Re: [UPDATE} comms/hyl;afax 6.0.6 to 7.0.11 To: Stuart Henderson Cc: OpenBSD Ports Date: Thu, 26 Mar 2026 00:48:16 +0800 On 25/03/2026 11:55 pm, Stuart Henderson wrote: > On 2026/03/25 15:46, Stuart Henderson wrote: >> There are some things I'm not too sure about but will be easier to work >> with smaller diffs for that > > I don't see how these cmdlen-related changes can do anything, > > - cmdlen++; /* Include NUL character */ > + if (cmdlen > 0) cmdlen++; /* Include NUL character */ > > they're all snprintf to a static buffer and all have a non empty format > string, so doesn't seem it can ever be hit. I think removing would make > sense, do you agree? > I'm not a programmer so I'll take your advice on-board. I received a lot of help from Lee Howard (HylaFAX+) to get this working on OpenBSD. These patches were included as part of a number of changes to resolve a problem with faxrm in HylaFAX+. The problem I reported was that faxrm would not remove a fax from the queue which is currently being processed. Not withstanding, these changes will be in HylaFAX+ 7.0.12 when it is released. I back-ported the changes we made to 7.0.11. I'll remove the patches below in my test environment and I'll get back to you with the results on whether they affect faxrm. > Index: patches/patch-util_faxconfig_c > =================================================================== > RCS file: patches/patch-util_faxconfig_c > diff -N patches/patch-util_faxconfig_c > --- patches/patch-util_faxconfig_c 25 Mar 2026 15:47:01 -0000 1.1 > +++ /dev/null 1 Jan 1970 00:00:00 -0000 > @@ -1,12 +0,0 @@ > -Index: util/faxconfig.c > ---- util/faxconfig.c.orig > -+++ util/faxconfig.c > -@@ -128,7 +128,7 @@ main(int argc, char** argv) > - cmdlen = snprintf(cmd, cmdsize, "C%s%s:%s", > - isQueuer ? ":" : "", argv[optind], argv[optind+1]); > - } > -- cmdlen++; /* Include NUL character */ > -+ if (cmdlen > 0) cmdlen++; /* Include NUL character */ > - if (cmdlen < 1 || cmdlen > cmdsize || write(fifo, cmd, cmdlen) != cmdlen) { > - fatal("%s: FIFO write failed for command (%s)", > - argv[0], strerror(errno)); > Index: patches/patch-util_faxmodem_c > =================================================================== > RCS file: patches/patch-util_faxmodem_c > diff -N patches/patch-util_faxmodem_c > --- patches/patch-util_faxmodem_c 25 Mar 2026 15:47:01 -0000 1.1 > +++ /dev/null 1 Jan 1970 00:00:00 -0000 > @@ -1,12 +0,0 @@ > -Index: util/faxmodem.c > ---- util/faxmodem.c.orig > -+++ util/faxmodem.c > -@@ -315,7 +315,7 @@ main(int argc, char** argv) > - } else { > - cmdlen = snprintf(cmd, sizeof(cmd), "+%s:R%c%08x", devname, canpoll, caps); > - } > -- cmdlen++; /* Include NUL character */ > -+ if (cmdlen > 0) cmdlen++; /* Include NUL character */ > - if (cmdlen < 1 || cmdlen > sizeof(cmd) || write(fifo, cmd, cmdlen) != cmdlen) { > - fatal("%s: FIFO write failed for command (%s)", > - argv[0], strerror(errno)); > Index: patches/patch-util_faxmsg_c > =================================================================== > RCS file: patches/patch-util_faxmsg_c > diff -N patches/patch-util_faxmsg_c > --- patches/patch-util_faxmsg_c 25 Mar 2026 15:47:01 -0000 1.1 > +++ /dev/null 1 Jan 1970 00:00:00 -0000 > @@ -1,12 +0,0 @@ > -Index: util/faxmsg.c > ---- util/faxmsg.c.orig > -+++ util/faxmsg.c > -@@ -147,7 +147,7 @@ main(int argc, char** argv) > - fatal("%s: open: %s", fifoname, strerror(errno)); > - } > - cmdlen = snprintf(cmd, sizeof(cmd), cmdfmt, arg); > -- cmdlen++; /* Include NUL character */ > -+ if (cmdlen > 0) cmdlen++; /* Include NUL character */ > - if (cmdlen < 1 || cmdlen > sizeof(cmd) || write(fifo, cmd, cmdlen) != cmdlen) { > - fatal("FIFO write failed for command (%s)", strerror(errno)); > - } > Index: patches/patch-util_faxstate_c > =================================================================== > RCS file: patches/patch-util_faxstate_c > diff -N patches/patch-util_faxstate_c > --- patches/patch-util_faxstate_c 25 Mar 2026 15:47:01 -0000 1.1 > +++ /dev/null 1 Jan 1970 00:00:00 -0000 > @@ -1,12 +0,0 @@ > -Index: util/faxstate.c > ---- util/faxstate.c.orig > -+++ util/faxstate.c > -@@ -147,7 +147,7 @@ main(int argc, char** argv) > - fatal("%s: open: %s", fifoname, strerror(errno)); > - } > - cmdlen = snprintf(cmd, sizeof(cmd), "S%s", arg); > -- cmdlen++; /* Include NUL character */ > -+ if (cmdlen > 0) cmdlen++; /* Include NUL character */ > - if (cmdlen < 1 || cmdlen >= sizeof(cmd) || write(fifo, cmd, cmdlen) != cmdlen) { > - fatal("FIFO write failed for command (%s)", strerror(errno)); > - } > Cheers, Larry.