summaryrefslogtreecommitdiff
path: root/net/rdist6/files/patch-src_message.c
blob: 31b3bb53bf03190a4f9cf24ba66b3e6854b9fa93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- src/message.c.orig	1998-11-10 04:13:30 UTC
+++ src/message.c
@@ -462,8 +462,8 @@ static void msgsendnotify(msgfac, mtype, flags, msgbuf
 		return;
 
 	if (!msgfac->mf_fptr) {
-		register char *cp;
-		char *getenv();
+		const char *cp;
+		int	fd;
 
 		/*
 		 * Create and open a new temporary file
@@ -475,8 +475,8 @@ static void msgsendnotify(msgfac, mtype, flags, msgbuf
 		(void) sprintf(tempfile, "%s/%s", cp, _RDIST_TMP);
 
 		msgfac->mf_filename = tempfile;
-		(void) mktemp(msgfac->mf_filename);
-		if ((msgfac->mf_fptr = fopen(msgfac->mf_filename, "w"))==NULL)
+		fd = mkstemp(tempfile);
+		if (fd == -1 || (msgfac->mf_fptr = fdopen(fd, "w"))==NULL)
 			fatalerr("Cannot open notify file for writing: %s: %s.",
 			      msgfac->mf_filename, SYSERR);
 		debugmsg(DM_MISC, "Created notify temp file '%s'",
@@ -513,7 +513,7 @@ extern void checkhostname()
  */
 static void _message(flags, msgbuf)
 	int flags;
-	char *msgbuf;
+	const char *msgbuf;
 {
 	register int i, x;
 	register char *cp;