From c0feb81856ad898a033d903c3ee9cabd532ac6aa Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Debian Linux)" <rob@synchro.net> Date: Thu, 14 Nov 2024 21:16:17 -0800 Subject: [PATCH] Return 1 on failure (e.g. authentication failure), not 0 Only log message header read error if the msgbase.status is non-zero Don't try to import anything if the stop semfile is signaled while exporting. Increment revision to 1.2 --- exec/newslink.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/exec/newslink.js b/exec/newslink.js index cf66952224..158cf5299f 100644 --- a/exec/newslink.js +++ b/exec/newslink.js @@ -24,7 +24,7 @@ // s no subject filtering // m Moderate imported messages -const REVISION = "1.114"; +const REVISION = "1.2"; printf("Synchronet NewsLink %s session started\r\n", REVISION); @@ -174,7 +174,7 @@ cfg_file = new File(cfg_fname); if(!cfg_file.open("r")) { printf("!Error %d opening %s\r\n",errno,cfg_fname); delete cfg_file; - exit(); + exit(1); } while(!cfg_file.eof) { @@ -275,7 +275,7 @@ if(debug) { if(host==undefined || !host.length) { print("!No news server specified"); - exit(); + exit(1); } printf("Connecting to %s port %d ...\r\n",host,port); @@ -286,7 +286,7 @@ if(!socket.connect(host, port, connect_timeout)) { printf("!Error %d connecting to %s port %d\r\n" ,socket.last_error,host,port); delete socket; - exit(); + exit(1); } print("Connected"); if(tls) { @@ -310,7 +310,7 @@ if(username!=undefined && username.length) { if(rsp==null || rsp[0]!='2') { printf("!Authentication FAILURE: %s\r\n", rsp); delete socket; - exit(); + exit(1); } } print("Authenticated"); @@ -454,7 +454,8 @@ for(sub in area) { /* message number */ ptr ); if(hdr == null) { - alert("Failed to read msg header #" + ptr); + if(msgbase.status != 0) + alert("Error " + msgbase.error + " reading msg header #" + ptr); continue; } if(!hdr.id) { @@ -579,6 +580,9 @@ for(sub in area) { export_ptr = ptr; save_ptr(ini_file, "export_ptr", export_ptr); + if(stop_sem_signaled()) + break; + /***************************/ /* IMPORT Network Messages */ /***************************/ -- GitLab