0002-Switch-legacy-index-in-favour-of-strchr.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From a1d45736286939b822fcc7b9c74843f6f90a747e Mon Sep 17 00:00:00 2001
  2. From: Gustavo Zacarias <gustavo@zacarias.com.ar>
  3. Date: Sat, 10 Nov 2012 18:58:15 +0100
  4. Subject: [PATCH] Switch legacy index() in favour of strchr() Updated for 1.2.6
  5. from the previous patch by Frederik Pasch.
  6. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  7. ---
  8. support/nfs/nfs_mntent.c | 6 +++---
  9. utils/mount/error.c | 2 +-
  10. utils/mountd/fsloc.c | 2 +-
  11. 3 files changed, 5 insertions(+), 5 deletions(-)
  12. diff --git a/support/nfs/nfs_mntent.c b/support/nfs/nfs_mntent.c
  13. index a2118a2..7496ed6 100644
  14. --- a/support/nfs/nfs_mntent.c
  15. +++ b/support/nfs/nfs_mntent.c
  16. @@ -9,7 +9,7 @@
  17. */
  18. #include <stdio.h>
  19. -#include <string.h> /* for index */
  20. +#include <string.h> /* for strchr */
  21. #include <ctype.h> /* for isdigit */
  22. #include <sys/stat.h> /* for umask */
  23. #include <unistd.h> /* for ftruncate */
  24. @@ -172,7 +172,7 @@ nfs_getmntent (mntFILE *mfp) {
  25. return NULL;
  26. mfp->mntent_lineno++;
  27. - s = index (buf, '\n');
  28. + s = strchr (buf, '\n');
  29. if (s == NULL) {
  30. /* Missing final newline? Otherwise extremely */
  31. /* long line - assume file was corrupted */
  32. @@ -180,7 +180,7 @@ nfs_getmntent (mntFILE *mfp) {
  33. fprintf(stderr, _("[mntent]: warning: no final "
  34. "newline at the end of %s\n"),
  35. mfp->mntent_file);
  36. - s = index (buf, 0);
  37. + s = strchr (buf, 0);
  38. } else {
  39. mfp->mntent_errs = 1;
  40. goto err;
  41. diff --git a/utils/mount/error.c b/utils/mount/error.c
  42. index e06f598..7bd1d27 100644
  43. --- a/utils/mount/error.c
  44. +++ b/utils/mount/error.c
  45. @@ -62,7 +62,7 @@ static int rpc_strerror(int spos)
  46. char *tmp;
  47. if (estr) {
  48. - if ((ptr = index(estr, ':')))
  49. + if ((ptr = strchr(estr, ':')))
  50. estr = ++ptr;
  51. tmp = &errbuf[spos];
  52. diff --git a/utils/mountd/fsloc.c b/utils/mountd/fsloc.c
  53. index bc737d1..ddbe92f 100644
  54. --- a/utils/mountd/fsloc.c
  55. +++ b/utils/mountd/fsloc.c
  56. @@ -127,7 +127,7 @@ static struct servers *method_list(char *data)
  57. bool v6esc = false;
  58. xlog(L_NOTICE, "method_list(%s)", data);
  59. - for (ptr--, listsize=1; ptr; ptr=index(ptr, ':'), listsize++)
  60. + for (ptr--, listsize=1; ptr; ptr=strchr(ptr, ':'), listsize++)
  61. ptr++;
  62. list = malloc(listsize * sizeof(char *));
  63. copy = strdup(data);
  64. --
  65. 2.1.0