summaryrefslogtreecommitdiffstats
path: root/bin/ed/buf.c
diff options
context:
space:
mode:
authoralm <alm@FreeBSD.org>1994-03-23 04:36:59 +0000
committeralm <alm@FreeBSD.org>1994-03-23 04:36:59 +0000
commitbe89471c9d6a4de60171c625d1b0ab147abb0770 (patch)
tree4b0e608c16c0dfe8beaba8e03e6035747472bad2 /bin/ed/buf.c
parente5072b4eb54bf8b59e1b47c4fc8d7f81c6b5a80c (diff)
downloadFreeBSD-src-be89471c9d6a4de60171c625d1b0ab147abb0770.zip
FreeBSD-src-be89471c9d6a4de60171c625d1b0ab147abb0770.tar.gz
use umask 077 for buffer file
Diffstat (limited to 'bin/ed/buf.c')
-rw-r--r--bin/ed/buf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/ed/buf.c b/bin/ed/buf.c
index 7513064..7027599 100644
--- a/bin/ed/buf.c
+++ b/bin/ed/buf.c
@@ -26,10 +26,11 @@
* SUCH DAMAGE.
*/
#ifndef lint
-static char *rcsid = "@(#)$Id: buf.c,v 1.3 1993/12/14 16:19:56 alm Exp $";
+static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp";
#endif /* not lint */
#include <sys/file.h>
+#include <sys/stat.h>
#include "ed.h"
@@ -131,7 +132,7 @@ add_line_node(lp)
line_t *cp;
cp = get_addressed_line_node(current_addr); /* this get_addressed_line_node last! */
- insque(lp, cp);
+ INSQUE(lp, cp);
addr_last++;
current_addr++;
}
@@ -195,13 +196,18 @@ char sfn[15] = ""; /* scratch file name */
int
open_sbuf()
{
+ int u;
+
isbinary = newline_added = 0;
+ u = umask(077);
strcpy(sfn, "/tmp/ed.XXXXXX");
if (mktemp(sfn) == NULL || (sfp = fopen(sfn, "w+")) == NULL) {
fprintf(stderr, "%s: %s\n", sfn, strerror(errno));
sprintf(errmsg, "cannot open temp file");
+ umask(u);
return ERR;
}
+ umask(u);
return 0;
}
OpenPOWER on IntegriCloud