summaryrefslogtreecommitdiffstats
path: root/usr.sbin/timed
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-10-29 07:32:30 +0000
committercharnier <charnier@FreeBSD.org>1997-10-29 07:32:30 +0000
commit68d30808a9b4aace82ed37f4212fa6e5b3e66fd1 (patch)
treea84a43186273a969a58651b6437a7d5748cca281 /usr.sbin/timed
parentcf8568c7a3da5d6adf1faed18886c40964858f55 (diff)
downloadFreeBSD-src-68d30808a9b4aace82ed37f4212fa6e5b3e66fd1.zip
FreeBSD-src-68d30808a9b4aace82ed37f4212fa6e5b3e66fd1.tar.gz
Back out strcpy() -> strncpy() changes. According to bruce, they are unneeded.
Diffstat (limited to 'usr.sbin/timed')
-rw-r--r--usr.sbin/timed/timed/acksend.c5
-rw-r--r--usr.sbin/timed/timed/candidate.c9
-rw-r--r--usr.sbin/timed/timed/correct.c6
-rw-r--r--usr.sbin/timed/timed/globals.h4
-rw-r--r--usr.sbin/timed/timed/master.c45
-rw-r--r--usr.sbin/timed/timed/readmsg.c5
-rw-r--r--usr.sbin/timed/timed/slave.c66
-rw-r--r--usr.sbin/timed/timed/timed.c18
8 files changed, 46 insertions, 112 deletions
diff --git a/usr.sbin/timed/timed/acksend.c b/usr.sbin/timed/timed/acksend.c
index 8197bc2..766505c 100644
--- a/usr.sbin/timed/timed/acksend.c
+++ b/usr.sbin/timed/timed/acksend.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)acksend.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: acksend.c,v 1.2 1997/10/22 06:19:48 charnier Exp $";
#endif /* not lint */
#include "globals.h"
@@ -56,8 +56,7 @@ xmit(type, seq, addr)
msg.tsp_type = type;
msg.tsp_seq = seq;
msg.tsp_vers = TSPVERSION;
- (void)strncpy(msg.tsp_name, hostname, sizeof msg.tsp_name-1);
- msg.tsp_name[sizeof msg.tsp_name-1] = '\0';
+ (void)strcpy(msg.tsp_name, hostname);
bytenetorder(&msg);
if (sendto(sock, (char *)&msg, sizeof(struct tsp), 0,
(struct sockaddr*)addr, sizeof(struct sockaddr)) < 0) {
diff --git a/usr.sbin/timed/timed/candidate.c b/usr.sbin/timed/timed/candidate.c
index 2a4f2a1..b64f296 100644
--- a/usr.sbin/timed/timed/candidate.c
+++ b/usr.sbin/timed/timed/candidate.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)candidate.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: candidate.c,v 1.3 1997/10/22 06:19:48 charnier Exp $";
#endif /* not lint */
#include "globals.h"
@@ -80,8 +80,7 @@ again:
fprintf(fd, "This machine is a candidate time master\n");
msg.tsp_type = TSP_ELECTION;
msg.tsp_vers = TSPVERSION;
- (void)strncpy(msg.tsp_name, hostname, sizeof msg.tsp_name-1);
- msg.tsp_name[sizeof msg.tsp_name-1] = '\0';
+ (void)strcpy(msg.tsp_name, hostname);
bytenetorder(&msg);
if (sendto(sock, (char *)&msg, sizeof(struct tsp), 0,
(struct sockaddr*)&net->dest_addr,
@@ -140,9 +139,7 @@ again:
/* no master for another round */
htp = addmach(resp->tsp_name,&from,fromnet);
msg.tsp_type = TSP_REFUSE;
- (void)strncpy(msg.tsp_name, hostname,
- sizeof msg.tsp_name-1);
- msg.tsp_name[sizeof msg.tsp_name-1] = '\0';
+ (void)strcpy(msg.tsp_name, hostname);
answer = acksend(&msg, &htp->addr, htp->name,
TSP_ACK, 0, htp->noanswer);
if (!answer) {
diff --git a/usr.sbin/timed/timed/correct.c b/usr.sbin/timed/timed/correct.c
index 4237311..f28d103 100644
--- a/usr.sbin/timed/timed/correct.c
+++ b/usr.sbin/timed/timed/correct.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)correct.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: correct.c,v 1.2 1997/10/22 06:19:48 charnier Exp $";
#endif /* not lint */
#include "globals.h"
@@ -84,9 +84,7 @@ correct(avdelta)
mstotvround(&to.tsp_time, corr);
to.tsp_type = TSP_ADJTIME;
}
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
answer = acksend(&to, &htp->addr, htp->name,
TSP_ACK, 0, 0);
if (!answer) {
diff --git a/usr.sbin/timed/timed/globals.h b/usr.sbin/timed/timed/globals.h
index f91f91f..9005a2a 100644
--- a/usr.sbin/timed/timed/globals.h
+++ b/usr.sbin/timed/timed/globals.h
@@ -33,10 +33,6 @@
* @(#)globals.h 8.1 (Berkeley) 6/6/93
*/
-#ifdef sgi
-#ident "$Revision: 1.1.1.1 $"
-#endif
-
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
diff --git a/usr.sbin/timed/timed/master.c b/usr.sbin/timed/timed/master.c
index 97fb489..14dc6d1 100644
--- a/usr.sbin/timed/timed/master.c
+++ b/usr.sbin/timed/timed/master.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)master.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: master.c,v 1.3 1997/10/22 06:19:48 charnier Exp $";
#endif /* not lint */
#include "globals.h"
@@ -150,9 +150,7 @@ loop:
to.tsp_vers = TSPVERSION;
to.tsp_seq = sequence++;
to.tsp_hopcnt = MAX_HOPCNT;
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
bytenetorder(&to);
if (sendto(sock, (char *)&to,
sizeof(struct tsp), 0,
@@ -181,9 +179,7 @@ loop:
#ifdef sgi
(void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec);
#else
- (void)strncpy(newdate, ctime(&msg->tsp_time.tv_sec),
- sizeof newdate-1);
- newdate[sizeof newdate-1] = '\0';
+ (void)strcpy(newdate, ctime(&msg->tsp_time.tv_sec));
#endif /* sgi */
if (!good_host_name(msg->tsp_name)) {
syslog(LOG_NOTICE,
@@ -204,9 +200,7 @@ loop:
#ifdef sgi
(void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec);
#else
- (void)strncpy(newdate, ctime(&msg->tsp_time.tv_sec),
- sizeof newdate-1);
- newdate[sizeof newdate-1] = '\0';
+ (void)strcpy(newdate, ctime(&msg->tsp_time.tv_sec));
#endif /* sgi */
htp = findhost(msg->tsp_name);
if (htp == 0) {
@@ -254,12 +248,9 @@ loop:
(void)addmach(msg->tsp_name, &from,fromnet);
}
taddr = from;
- (void)strncpy(tname, msg->tsp_name, sizeof tname-1);
- tname[sizeof tname-1] = '\0';
+ (void)strcpy(tname, msg->tsp_name);
to.tsp_type = TSP_QUIT;
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
answer = acksend(&to, &taddr, tname,
TSP_ACK, 0, 1);
if (answer == NULL) {
@@ -276,9 +267,7 @@ loop:
*/
if (!fromnet || fromnet->status != MASTER)
break;
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
/* The other master often gets into the same state,
* with boring results if we stay at it forever.
@@ -286,9 +275,7 @@ loop:
ntp = fromnet; /* (acksend() can leave fromnet=0 */
for (i = 0; i < 3; i++) {
to.tsp_type = TSP_RESOLVE;
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
answer = acksend(&to, &ntp->dest_addr,
ANYADDR, TSP_MASTERACK,
ntp, 0);
@@ -333,9 +320,7 @@ loop:
*/
htp = addmach(msg->tsp_name, &from,fromnet);
to.tsp_type = TSP_QUIT;
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
answer = acksend(&to, &htp->addr, htp->name,
TSP_ACK, 0, 1);
if (!answer) {
@@ -379,13 +364,11 @@ mchgdate(msg)
char olddate[32];
struct timeval otime, ntime;
- (void)strncpy(tname, msg->tsp_name, sizeof tname-1);
- tname[sizeof tname-1] = '\0';
+ (void)strcpy(tname, msg->tsp_name);
xmit(TSP_DATEACK, msg->tsp_seq, &from);
- (void)strncpy(olddate, date(), sizeof olddate-1);
- olddate[sizeof olddate-1] = '\0';
+ (void)strcpy(olddate, date());
/* adjust time for residence on the queue */
(void)gettimeofday(&otime, 0);
@@ -520,8 +503,7 @@ spreadtime()
dictate = 2;
for (htp = self.l_fwd; htp != &self; htp = htp->l_fwd) {
to.tsp_type = TSP_SETTIME;
- (void)strncpy(to.tsp_name, hostname, sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
(void)gettimeofday(&to.tsp_time, 0);
answer = acksend(&to, &htp->addr, htp->name,
TSP_ACK, 0, htp->noanswer);
@@ -805,8 +787,7 @@ newslave(msg)
if (now.tv_sec >= fromnet->slvwait.tv_sec+3
|| now.tv_sec < fromnet->slvwait.tv_sec) {
to.tsp_type = TSP_SETTIME;
- (void)strncpy(to.tsp_name, hostname, sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
(void)gettimeofday(&to.tsp_time, 0);
answer = acksend(&to, &htp->addr,
htp->name, TSP_ACK,
diff --git a/usr.sbin/timed/timed/readmsg.c b/usr.sbin/timed/timed/readmsg.c
index 13e390b..580bbbf 100644
--- a/usr.sbin/timed/timed/readmsg.c
+++ b/usr.sbin/timed/timed/readmsg.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)readmsg.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: readmsg.c,v 1.2 1997/10/22 06:19:48 charnier Exp $";
#endif /* not lint */
#include "globals.h"
@@ -393,8 +393,7 @@ masterack()
resp = msgin;
resp.tsp_vers = TSPVERSION;
- (void)strncpy(resp.tsp_name, hostname, sizeof resp.tsp_name-1);
- resp.tsp_name[sizeof resp.tsp_name-1] = '\0';
+ (void)strcpy(resp.tsp_name, hostname);
switch(msgin.tsp_type) {
diff --git a/usr.sbin/timed/timed/slave.c b/usr.sbin/timed/timed/slave.c
index d0e2dc0..24c71ab 100644
--- a/usr.sbin/timed/timed/slave.c
+++ b/usr.sbin/timed/timed/slave.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)slave.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: slave.c,v 1.3 1997/10/22 06:19:48 charnier Exp $";
#endif /* not lint */
#include "globals.h"
@@ -151,9 +151,7 @@ loop:
to.tsp_vers = TSPVERSION;
to.tsp_seq = sequence++;
to.tsp_hopcnt = MAX_HOPCNT;
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
bytenetorder(&to);
if (sendto(sock, (char *)&to, sizeof(struct tsp), 0,
(struct sockaddr*)&ntp->dest_addr,
@@ -267,11 +265,8 @@ loop:
* the following line is necessary due to syslog
* calling ctime() which clobbers the static buffer
*/
- (void)strncpy(olddate, date(), sizeof olddate-1);
- olddate[sizeof olddate-1] = '\0';
- (void)strncpy(newdate, ctime(&msg->tsp_time.tv_sec),
- sizeof newdate-1);
- newdate[sizeof newdate-1] = '\0';
+ (void)strcpy(olddate, date());
+ (void)strcpy(newdate, ctime(&msg->tsp_time.tv_sec));
#endif /* sgi */
if (!good_host_name(msg->tsp_name)) {
@@ -362,9 +357,7 @@ loop:
#ifdef sgi
(void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec);
#else
- (void)strncpy(newdate, ctime(&msg->tsp_time.tv_sec),
- sizeof newdate-1);
- newdate[sizeof newdate-1] = '\0';
+ (void)strcpy(newdate, ctime(&msg->tsp_time.tv_sec));
#endif /* sgi */
schgdate(msg, newdate);
break;
@@ -375,9 +368,7 @@ loop:
#ifdef sgi
(void)cftime(newdate, "%D %T", &msg->tsp_time.tv_sec);
#else
- (void)strncpy(newdate, ctime(&msg->tsp_time.tv_sec),
- sizeof newdate-1);
- newdate[sizeof newdate-1] = '\0';
+ (void)strcpy(newdate, ctime(&msg->tsp_time.tv_sec));
#endif /* sgi */
htp = findhost(msg->tsp_name);
if (0 == htp) {
@@ -431,12 +422,8 @@ loop:
refusetime = ntime.tv_sec + 30;
}
taddr = from;
- (void)strncpy(tname, msg->tsp_name,
- sizeof tname-1);
- tname[sizeof tname-1] = '\0';
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(tname, msg->tsp_name);
+ (void)strcpy(to.tsp_name, hostname);
answerdelay();
if (!acksend(&to, &taddr, tname,
TSP_ACK, 0, 0))
@@ -447,9 +434,7 @@ loop:
} else { /* fromnet->status == MASTER */
htp = addmach(msg->tsp_name, &from,fromnet);
to.tsp_type = TSP_QUIT;
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
if (!acksend(&to, &htp->addr, htp->name,
TSP_ACK, 0, htp->noanswer)) {
syslog(LOG_ERR,
@@ -468,9 +453,7 @@ loop:
* more than one master: the first slave to
* come up will notify here the situation.
*/
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
/* The other master often gets into the same state,
* with boring results.
@@ -504,9 +487,7 @@ loop:
to.tsp_type = TSP_MSITEREQ;
to.tsp_vers = TSPVERSION;
to.tsp_seq = 0;
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
answer = acksend(&to, &slavenet->dest_addr,
ANYADDR, TSP_ACK,
slavenet, 0);
@@ -514,14 +495,12 @@ loop:
&& good_host_name(answer->tsp_name)) {
setmaster(answer);
to.tsp_type = TSP_ACK;
- (void)strncpy(to.tsp_name, answer->tsp_name,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, answer->tsp_name);
bytenetorder(&to);
if (sendto(sock, (char *)&to,
sizeof(struct tsp), 0,
(struct sockaddr*)&taddr,
- sizeof(taddr)) < 0) {
+ sizeof(taddr)) < 0) {
trace_sendto_err(taddr.sin_addr);
}
}
@@ -566,13 +545,9 @@ loop:
if (answer == NULL)
break;
taddr = from;
- (void)strncpy(tname, answer->tsp_name,
- sizeof tname-1);
- tname[sizeof tname-1] = '\0';
+ (void)strcpy(tname, answer->tsp_name);
to.tsp_type = TSP_QUIT;
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
if (!acksend(&to, &taddr, tname,
TSP_ACK, 0, 1)) {
syslog(LOG_ERR,
@@ -625,9 +600,7 @@ loop:
htp = addmach(answer->tsp_name,
&from,ntp);
to.tsp_type = TSP_QUIT;
- (void)strncpy(to.tsp_name, hostname,
- sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
if (!acksend(&to,&htp->addr,htp->name,
TSP_ACK, 0, htp->noanswer)) {
syslog(LOG_ERR,
@@ -663,9 +636,7 @@ setmaster(msg)
&& (slavenet != old_slavenet
|| strcmp(msg->tsp_name, master_name)
|| old_status != status)) {
- (void)strncpy(master_name, msg->tsp_name,
- sizeof master_name-1);
- master_name[sizeof master_name-1] = '\0';
+ (void)strcpy(master_name, msg->tsp_name);
old_slavenet = slavenet;
old_status = status;
@@ -713,8 +684,7 @@ schgdate(msg, newdate)
to.tsp_type = TSP_SETDATEREQ;
to.tsp_time = msg->tsp_time;
- (void)strncpy(to.tsp_name, hostname, sizeof to.tsp_name-1);
- to.tsp_name[sizeof to.tsp_name-1] = '\0';
+ (void)strcpy(to.tsp_name, hostname);
if (!acksend(&to, &slavenet->dest_addr,
ANYADDR, TSP_DATEACK,
slavenet, 0))
diff --git a/usr.sbin/timed/timed/timed.c b/usr.sbin/timed/timed/timed.c
index c5e0f22..a3c11e3 100644
--- a/usr.sbin/timed/timed/timed.c
+++ b/usr.sbin/timed/timed/timed.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)timed.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: timed.c,v 1.5 1997/10/22 06:19:49 charnier Exp $";
#endif /* not lint */
#define TSPTYPES
@@ -573,8 +573,7 @@ suppress(addr, name,net)
if (trace)
fprintf(fd, "suppress: %s\n", name);
tgt = *addr;
- (void)strncpy(tname, name, sizeof tname-1);
- tname[sizeof tname-1] = '\0';
+ (void)strcpy(tname, name);
while (0 != readmsg(TSP_ANY, ANYADDR, &wait, net)) {
if (trace)
@@ -584,8 +583,7 @@ suppress(addr, name,net)
syslog(LOG_NOTICE, "suppressing false master %s", tname);
msg.tsp_type = TSP_QUIT;
- (void)strncpy(msg.tsp_name, hostname, sizeof msg.tsp_name-1);
- msg.tsp_name[sizeof msg.tsp_name-1] = '\0';
+ (void)strcpy(msg.tsp_name, hostname);
(void)acksend(&msg, &tgt, tname, TSP_ACK, 0, 1);
}
@@ -603,8 +601,7 @@ lookformaster(ntp)
/* look for master */
resp.tsp_type = TSP_MASTERREQ;
- (void)strncpy(resp.tsp_name, hostname, sizeof resp.tsp_name-1);
- resp.tsp_name[sizeof resp.tsp_name-1] = '\0';
+ (void)strcpy(resp.tsp_name, hostname);
answer = acksend(&resp, &ntp->dest_addr, ANYADDR,
TSP_MASTERACK, ntp, 0);
if (answer != 0 && !good_host_name(answer->tsp_name)) {
@@ -659,8 +656,7 @@ lookformaster(ntp)
}
ntp->status = SLAVE;
- (void)strncpy(mastername, answer->tsp_name, sizeof mastername-1);
- mastername[sizeof mastername-1] = '\0';
+ (void)strcpy(mastername, answer->tsp_name);
masteraddr = from;
/*
@@ -678,9 +674,7 @@ lookformaster(ntp)
if (answer != NULL &&
strcmp(answer->tsp_name, mastername) != 0) {
conflict.tsp_type = TSP_CONFLICT;
- (void)strncpy(conflict.tsp_name, hostname,
- sizeof conflict.tsp_name-1);
- conflict.tsp_name[sizeof conflict.tsp_name-1] = '\0';
+ (void)strcpy(conflict.tsp_name, hostname);
if (!acksend(&conflict, &masteraddr, mastername,
TSP_ACK, 0, 0)) {
syslog(LOG_ERR,
OpenPOWER on IntegriCloud