diff options
Diffstat (limited to 'sysutils/user/patches/patch-aa')
-rw-r--r-- | sysutils/user/patches/patch-aa | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/sysutils/user/patches/patch-aa b/sysutils/user/patches/patch-aa new file mode 100644 index 00000000000..1fd09c98717 --- /dev/null +++ b/sysutils/user/patches/patch-aa @@ -0,0 +1,55 @@ +$NetBSD: patch-aa,v 1.1.1.1 1999/12/16 16:28:31 agc Exp $ + +Bring in strlcpy(3) from -current for those versions of NetBSD which +don't have it. + +--- user.c Thu Dec 16 15:46:16 1999 ++++ user.c Thu Dec 16 16:17:17 1999 +@@ -92,6 +92,47 @@ + return ret; + } + ++#if __NetBSD_Version__ < 104110000 ++#undef _DIAGASSERT ++#define _DIAGASSERT(x) ++/* ++ * Copy src to string dst of size siz. At most siz-1 characters ++ * will be copied. Always NUL terminates (unless siz == 0). ++ * Returns strlen(src); if retval >= siz, truncation occurred. ++ */ ++size_t ++strlcpy(dst, src, siz) ++ char *dst; ++ const char *src; ++ size_t siz; ++{ ++ register char *d = dst; ++ register const char *s = src; ++ register size_t n = siz; ++ ++ _DIAGASSERT(dst != NULL); ++ _DIAGASSERT(src != NULL); ++ ++ /* Copy as many bytes as will fit */ ++ if (n != 0 && --n != 0) { ++ do { ++ if ((*d++ = *s++) == 0) ++ break; ++ } while (--n != 0); ++ } ++ ++ /* Not enough room in dst, add NUL and traverse rest of src */ ++ if (n == 0) { ++ if (siz != 0) ++ *d = '\0'; /* NUL-terminate dst */ ++ while (*s++) ++ ; ++ } ++ ++ return(s - src - 1); /* count does not include NUL */ ++} ++#endif ++ + /* copy any dot files into the user's home directory */ + static int + copydotfiles(char *skeldir, int uid, int gid, char *dir) |