diff options
author | 1999-06-08 20:12:28 +0000 | |
---|---|---|
committer | 1999-06-08 20:12:28 +0000 | |
commit | 7f005aaa42ce111db07fde6c0e24346cf956b9dc (patch) | |
tree | b38bbcedd01bb016d2101e03513ff07735eebddf | |
parent | Don't drop the last character from lines in ppp.secret unless it's '\n'. (diff) | |
download | wireguard-openbsd-7f005aaa42ce111db07fde6c0e24346cf956b9dc.tar.xz wireguard-openbsd-7f005aaa42ce111db07fde6c0e24346cf956b9dc.zip |
Don't use static variables if we don't have to.
-rw-r--r-- | usr.sbin/ppp/ppp/command.c | 14 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/ipcp.c | 5 |
2 files changed, 11 insertions, 8 deletions
diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c index 06abdae701d..1799940a59a 100644 --- a/usr.sbin/ppp/ppp/command.c +++ b/usr.sbin/ppp/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.25 1999/06/05 21:35:58 brian Exp $ + * $Id: command.c,v 1.26 1999/06/08 20:12:28 brian Exp $ * */ #include <sys/param.h> @@ -143,7 +143,7 @@ #define NEG_DNS 52 const char Version[] = "2.22"; -const char VersionDate[] = "$Date: 1999/06/05 21:35:58 $"; +const char VersionDate[] = "$Date: 1999/06/08 20:12:28 $"; static int ShowCommand(struct cmdargs const *); static int TerminalCommand(struct cmdargs const *); @@ -935,16 +935,20 @@ command_Run(struct bundle *bundle, int argc, char const *const *argv, { if (argc > 0) { if (log_IsKept(LogCOMMAND)) { - static char buf[LINE_LEN]; + char buf[LINE_LEN]; int f, n; - *buf = '\0'; if (label) { strncpy(buf, label, sizeof buf - 3); buf[sizeof buf - 3] = '\0'; strcat(buf, ": "); + n = strlen(buf); + } else { + *buf = '\0'; + n = 0; } - n = strlen(buf); + buf[sizeof buf - 1] = '\0'; /* In case we run out of room in buf */ + for (f = 0; f < argc; f++) { if (n < sizeof buf - 1 && f) buf[n++] = ' '; diff --git a/usr.sbin/ppp/ppp/ipcp.c b/usr.sbin/ppp/ppp/ipcp.c index 701cd21a86b..8ed43b19140 100644 --- a/usr.sbin/ppp/ppp/ipcp.c +++ b/usr.sbin/ppp/ppp/ipcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.c,v 1.16 1999/06/08 11:59:00 brian Exp $ + * $Id: ipcp.c,v 1.17 1999/06/08 20:12:30 brian Exp $ * * TODO: * o Support IPADDRS properly @@ -504,8 +504,7 @@ static int ipcp_SetIPaddress(struct bundle *bundle, struct in_addr myaddr, struct in_addr hisaddr, int silent) { - static struct in_addr none = { INADDR_ANY }; - struct in_addr mask, oaddr; + struct in_addr mask, oaddr, none = { INADDR_ANY }; mask = addr2mask(myaddr); |