From 3c940936f8181a1de2603095f5d933a1c1bd85cb Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sat, 6 Sep 2003 06:01:36 +0000
Subject: [PATCH] Displays a different error if motd file is missing, and if it
 can't be opened.

---
 exec/ircd.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/exec/ircd.js b/exec/ircd.js
index f046a8a533..398505e801 100644
--- a/exec/ircd.js
+++ b/exec/ircd.js
@@ -1111,7 +1111,11 @@ function IRCClient_lusers() {
 
 function IRCClient_motd() {
 	motd_file = new File(system.text_dir + "ircmotd.txt");
-	if (motd_file.open("r")) {
+	if (motd_file.exists==false)
+		this.numeric(422, ":MOTD file missing: " + motd_file.name);
+	else if (motd_file.open("r")==false)
+		this.numeric(422, ":MOTD error " + errno + " opening: " + motd_file.name);
+	else {
 		this.numeric(375, ":- " + servername + " Message of the Day -");
 		this.numeric(372, ":- " + strftime("%m/%d/%Y %H:%M",motd_file.date));
 		while (!motd_file.eof) {
@@ -1119,8 +1123,7 @@ function IRCClient_motd() {
 			if (motd_line != null)
 				this.numeric(372, ":- " + motd_line);
 		}
-	} else {
-		this.numeric(422, ":MOTD file is missing.");
+		motd_file.close();
 	}
 	this.numeric(376, ":End of /MOTD command.");
 }
-- 
GitLab