mode so that you can't easily change it. also, will not read back in the
new version in read only mode.
SCCS-vsn: usr.bin/mail/edit.c 1.2
* Perform message editing functions.
*/
* Perform message editing functions.
*/
-static char *SccsId = "@(#)edit.c 1.1 %G%";
+static char *SccsId = "@(#)edit.c 1.2 %G%";
/*
* Edit a message list.
/*
* Edit a message list.
+ /*
+ * If we are in read only mode, make the
+ * temporary message file readonly as well.
+ */
+
+ if (readonly)
+ chmod(edname, 0400);
+
/*
* Fork/execl the editor on the edit file.
*/
/*
* Fork/execl the editor on the edit file.
*/
while (wait(&mesg) != pid)
;
while (wait(&mesg) != pid)
;
+ /*
+ * If in read only mode, just remove the editor
+ * temporary and return.
+ */
+
+ if (readonly) {
+ remove(edname);
+ continue;
+ }
+
/*
* Now copy the message to the end of the
* temp file.
/*
* Now copy the message to the end of the
* temp file.