diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-01-16 06:40:24 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-01-16 06:40:24 +0000 |
commit | 315054f4737a39489e0a14f3a92bff61f1592832 (patch) | |
tree | 62bf010653374ce09b6beb4dfa0414a91457233b /bin/cp/cp.c | |
parent | 79e3d817585ca08a91e30ad14abe43e2ab70295f (diff) |
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/cp/cp.c')
-rw-r--r-- | bin/cp/cp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/cp/cp.c b/bin/cp/cp.c index 436e4eb6712..0b4f4361e8a 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cp.c,v 1.36 2014/05/21 06:23:02 guenther Exp $ */ +/* $OpenBSD: cp.c,v 1.37 2015/01/16 06:39:31 deraadt Exp $ */ /* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */ /* @@ -48,7 +48,7 @@ * in "to") to form the final target path. */ -#include <sys/param.h> +#include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> #include <sys/time.h> @@ -63,6 +63,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <limits.h> #include "extern.h" @@ -318,7 +319,7 @@ copy(char *argv[], enum op type, int fts_options) if (*p != '/' && target_mid[-1] != '/') *target_mid++ = '/'; *target_mid = '\0'; - if (target_mid - to.p_path + nlen >= MAXPATHLEN) { + if (target_mid - to.p_path + nlen >= PATH_MAX) { warnx("%s%s: name too long (not copied)", to.p_path, p); rval = 1; |