summaryrefslogtreecommitdiffstats
path: root/bin/ed/main.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
commitb9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch)
tree72b2433e418dfa1aef5fcf8305617b97979a25d8 /bin/ed/main.c
parentimprove checksum parsing slightly. now handles filenames with spaces. (diff)
downloadwireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz
wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'bin/ed/main.c')
-rw-r--r--bin/ed/main.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/bin/ed/main.c b/bin/ed/main.c
index afbdb340682..c7cff84f86f 100644
--- a/bin/ed/main.c
+++ b/bin/ed/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.42 2014/12/04 08:34:04 daniel Exp $ */
+/* $OpenBSD: main.c,v 1.43 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
@@ -80,7 +80,7 @@ int interactive = 0; /* if set, we are in interactive mode */
/* if set, signal handlers are enabled */
volatile sig_atomic_t sigactive = 0;
-char old_filename[MAXPATHLEN] = ""; /* default filename */
+char old_filename[PATH_MAX] = ""; /* default filename */
int current_addr; /* current address in editor buffer */
int addr_last; /* last address in editor buffer */
int lineno; /* script line number */
@@ -962,7 +962,7 @@ get_filename(void)
return NULL;
if (n) printf("%s\n", shcmd + 1);
return shcmd;
- } else if (n >= MAXPATHLEN) {
+ } else if (n >= PATH_MAX) {
seterrmsg("filename too long");
return NULL;
}
@@ -973,7 +973,7 @@ get_filename(void)
return NULL;
}
#endif
- REALLOC(file, filesz, MAXPATHLEN, NULL);
+ REALLOC(file, filesz, PATH_MAX, NULL);
for (n = 0; *ibufp != '\n';)
file[n++] = *ibufp++;
file[n] = '\0';
@@ -1331,7 +1331,7 @@ has_trailing_escape(char *s, char *t)
}
-/* strip_escapes: return copy of escaped string of at most length MAXPATHLEN */
+/* strip_escapes: return copy of escaped string of at most length PATH_MAX */
char *
strip_escapes(char *s)
{
@@ -1340,12 +1340,12 @@ strip_escapes(char *s)
int i = 0;
- REALLOC(file, filesz, MAXPATHLEN, NULL);
+ REALLOC(file, filesz, PATH_MAX, NULL);
/* assert: no trailing escape */
while ((file[i++] = (*s == '\\') ? *++s : *s) != '\0' &&
- i < MAXPATHLEN-1)
+ i < PATH_MAX-1)
s++;
- file[MAXPATHLEN-1] = '\0';
+ file[PATH_MAX-1] = '\0';
return file;
}
@@ -1379,7 +1379,7 @@ signal_int(int signo)
void
handle_hup(int signo)
{
- char hup[MAXPATHLEN];
+ char hup[PATH_MAX];
if (!sigactive)
quit(1);