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.

60 lines
2.0 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. --- a/include/attributes.h
  14. +++ b/include/attributes.h
  15. @@ -91,9 +91,9 @@ typedef struct attrlist_ent { /* data fr
  16. * Implement a "cursor" for use in successive attr_list() calls.
  17. * It provides a way to find the last attribute that was returned in the
  18. * last attr_list() call so that we can get the next one without missing
  19. - * any. This should be bzero()ed before use and whenever it is desired to
  20. + * any. This should be zeroed before use and whenever it is desired to
  21. * start over from the beginning of the attribute list. The only valid
  22. - * operation on a cursor is to bzero() it.
  23. + * operation on a cursor is to zero it.
  24. */
  25. typedef struct attrlist_cursor {
  26. uint32_t opaque[4]; /* an opaque cookie */
  27. --- a/libattr/libattr.c
  28. +++ b/libattr/libattr.c
  29. @@ -298,7 +298,7 @@ attr_list(const char *path, char *buffer
  30. errno = EINVAL;
  31. return -1;
  32. }
  33. - bzero(buffer, sizeof(attrlist_t));
  34. + memset(buffer, 0, sizeof(attrlist_t));
  35. if (flags & ATTR_DONTFOLLOW)
  36. length = llistxattr(path, lbuf, sizeof(lbuf));
  37. @@ -348,7 +348,7 @@ attr_listf(int fd, char *buffer, const i
  38. errno = EINVAL;
  39. return -1;
  40. }
  41. - bzero(buffer, sizeof(attrlist_t));
  42. + memset(buffer, 0, sizeof(attrlist_t));
  43. length = flistxattr(fd, lbuf, sizeof(lbuf));
  44. if (length < 0)
  45. --- a/tools/attr.c
  46. +++ b/tools/attr.c
  47. @@ -228,7 +228,7 @@ main(int argc, char **argv)
  48. perror("malloc");
  49. exit(1);
  50. }
  51. - bzero((char *)&cursor, sizeof(cursor));
  52. + memset(&cursor, 0, sizeof(cursor));
  53. do {
  54. error = attr_list(filename, buffer, BUFSIZE,
  55. attrflags, &cursor);