diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-05-07 15:31:21 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-05-07 15:31:21 +0000 |
commit | 51702635af8445431054291c86aaace7c30b0970 (patch) | |
tree | e9cc4d28c401bd6046f71f62d186865d37c0141f /nis/nis_subr.c | |
parent | 1f07e6177553845817af5f7c90f148edd2e59d32 (diff) | |
download | glibc-51702635af8445431054291c86aaace7c30b0970.zip glibc-51702635af8445431054291c86aaace7c30b0970.tar.gz glibc-51702635af8445431054291c86aaace7c30b0970.tar.bz2 |
Update.cvs/libc-ud-970507
* locale/categories.def: Change type of _NL_CTYPE_CLASS_NAMES and
_NL_CTYPE_MAP_NAMES field to stringlist.
Change name of _NL_CTYPE_CODESET_NAME to "charmap".
* locale/localeinfo.h (enum value_type): Add stringlist.
* locale/programs/locale.c (show_info): Handle stringlist.
* locale/programs/charmap.c (charmap_read): If charmap file is not
using the given name try to find it by looking through all available
charmap files and compare the code set name.
* locale/programs/locale.c (write_charmaps): Also print names of
charset in <code_set_name> fields in the files.
* elf/ldd.bash.in: Correct translatable strings.
* posix/TESTS: Add some more tests for character class matching.
* posix/regex.c: Merge with GNU awk version.
(regex_compile): Use ISO C/amend 1 functions for character class
handling.
* posix/regex.h: Merge with GNU awk version.
* posix/getopt.c: Declare as master copies.
* posix/getopt1.c: Likewise.
* posix/getopt.h: Likewise.
* sysdeps/unix/sysv/linux/sys/mount.h: Add definitions for option
value to mount functions.
Patch by a sun <asun@zoology.washington.edu>.
* stdio-common/bug4.c (main): Use /tmp/bug4.test for concurrency
with other tests.
* sunrpc/svc_run.c (svc_exit): New, defined.
(svc_run): Test for svc_stop variable.
* sysdeps/m68k/s_cexp.c: Rewritten.
* sysdeps/m68k/s_cexpf.c: Likewise.
* sysdeps/m68k/s_cexpl.c: Likewise.
Diffstat (limited to 'nis/nis_subr.c')
-rw-r--r-- | nis/nis_subr.c | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/nis/nis_subr.c b/nis/nis_subr.c index 479e11d..780c27f 100644 --- a/nis/nis_subr.c +++ b/nis/nis_subr.c @@ -46,8 +46,16 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen) return NULL; } - if (i > 1) - strncpy (buffer, name, i - 1); + if (i > 0) + { + if ((size_t)i >= buflen) + { + errno = ERANGE; + return NULL; + } + strncpy (buffer, name, i); + buffer[i] = 0; + } return buffer; } @@ -89,38 +97,6 @@ nis_name_of_r (const_nis_name name, char *buffer, size_t buflen) return buffer; } -nis_name -nis_domain_of (const_nis_name name) -{ - static char result[NIS_MAXNAMELEN + 1]; - - return nis_domain_of_r (name, result, NIS_MAXNAMELEN); -} - -nis_name -nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen) -{ - char *cptr; - size_t cptr_len; - - cptr = strchr (name, '.'); /* XXX What happens if the NIS name - does not contain a `.'? */ - ++cptr; - cptr_len = strlen (cptr); - - if (cptr_len == 0) - strcpy (buffer, "."); - else if (cptr_len >= buflen) - { - errno = ERANGE; - return NULL; - } - else - memcpy (buffer, cptr, cptr_len + 1); - - return buffer; -} - static int count_dots (const_nis_name str) { |