You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.3 KiB

  1. From 0ce120a140dadaa56875af2efc66ff805d37925b Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Sun, 11 Aug 2019 16:17:11 -0700
  4. Subject: [PATCH] attr: Replace bzero with memset
  5. bzero is a deprecated function that is optionally unavailable with
  6. uClibc-ng.
  7. Signed-off-by: Rosen Penev <rosenp@gmail.com>
  8. ---
  9. include/attributes.h | 4 ++--
  10. libattr/libattr.c | 4 ++--
  11. tools/attr.c | 2 +-
  12. 3 files changed, 5 insertions(+), 5 deletions(-)
  13. diff --git a/include/attributes.h b/include/attributes.h
  14. index 14beb8f..039c817 100644
  15. --- a/include/attributes.h
  16. +++ b/include/attributes.h
  17. @@ -91,9 +91,9 @@ typedef struct attrlist_ent { /* data from attr_list() */
  18. * Implement a "cursor" for use in successive attr_list() calls.
  19. * It provides a way to find the last attribute that was returned in the
  20. * last attr_list() call so that we can get the next one without missing
  21. - * any. This should be bzero()ed before use and whenever it is desired to
  22. + * any. This should be zeroed before use and whenever it is desired to
  23. * start over from the beginning of the attribute list. The only valid
  24. - * operation on a cursor is to bzero() it.
  25. + * operation on a cursor is to zero it.
  26. */
  27. typedef struct attrlist_cursor {
  28. uint32_t opaque[4]; /* an opaque cookie */
  29. diff --git a/libattr/libattr.c b/libattr/libattr.c
  30. index d550e10..2ebd1c5 100644
  31. --- a/libattr/libattr.c
  32. +++ b/libattr/libattr.c
  33. @@ -298,7 +298,7 @@ attr_list(const char *path, char *buffer, const int buffersize, int flags,
  34. errno = EINVAL;
  35. return -1;
  36. }
  37. - bzero(buffer, sizeof(attrlist_t));
  38. + memset(buffer, 0, sizeof(attrlist_t));
  39. if (flags & ATTR_DONTFOLLOW)
  40. length = llistxattr(path, lbuf, sizeof(lbuf));
  41. @@ -348,7 +348,7 @@ attr_listf(int fd, char *buffer, const int buffersize, int flags,
  42. errno = EINVAL;
  43. return -1;
  44. }
  45. - bzero(buffer, sizeof(attrlist_t));
  46. + memset(buffer, 0, sizeof(attrlist_t));
  47. length = flistxattr(fd, lbuf, sizeof(lbuf));
  48. if (length < 0)
  49. diff --git a/tools/attr.c b/tools/attr.c
  50. index c8aa0b4..312aef1 100644
  51. --- a/tools/attr.c
  52. +++ b/tools/attr.c
  53. @@ -228,7 +228,7 @@ main(int argc, char **argv)
  54. perror("malloc");
  55. exit(1);
  56. }
  57. - bzero((char *)&cursor, sizeof(cursor));
  58. + memset(&cursor, 0, sizeof(cursor));
  59. do {
  60. error = attr_list(filename, buffer, BUFSIZE,
  61. attrflags, &cursor);
  62. --
  63. 2.17.1