net-snmp-5.1.2.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. diff -urN net-snmp-5.1.2-0rig/agent/mibgroup/ucd-snmp/disk.c net-snmp-5.1.2/agent/mibgroup/ucd-snmp/disk.c
  2. --- net-snmp-5.1.2-0rig/agent/mibgroup/ucd-snmp/disk.c 2004-07-02 15:12:35.000000000 +0200
  3. +++ net-snmp-5.1.2/agent/mibgroup/ucd-snmp/disk.c 2007-07-16 03:39:22.000000000 +0200
  4. @@ -97,7 +97,7 @@
  5. #if HAVE_STRING_H
  6. #include <string.h>
  7. #endif
  8. -#if HAVE_FSTAB_H
  9. +#if defined(HAVE_FSTAB_H)
  10. #include <fstab.h>
  11. #endif
  12. #if HAVE_MNTENT_H
  13. @@ -230,7 +230,7 @@
  14. static void
  15. disk_parse_config(const char *token, char *cptr)
  16. {
  17. -#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
  18. +#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
  19. char tmpbuf[1024];
  20. char path[STRMAX];
  21. int minpercent;
  22. @@ -272,13 +272,13 @@
  23. */
  24. add_device(path, find_device(path), minspace, minpercent, 1);
  25. }
  26. -#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
  27. +#endif /* defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS) */
  28. }
  29. static void
  30. disk_parse_config_all(const char *token, char *cptr)
  31. {
  32. -#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
  33. +#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
  34. char tmpbuf[1024];
  35. int minpercent = DISKMINPERCENT;
  36. @@ -311,7 +311,7 @@
  37. find_and_add_allDisks(minpercent);
  38. }
  39. }
  40. -#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
  41. +#endif /* defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS) */
  42. }
  43. @@ -374,16 +374,16 @@
  44. static void
  45. find_and_add_allDisks(int minpercent)
  46. {
  47. -#if HAVE_GETMNTENT
  48. +#if defined(HAVE_GETMNTENT)
  49. #if HAVE_SYS_MNTTAB_H
  50. struct mnttab mnttab;
  51. #else
  52. struct mntent *mntent;
  53. #endif
  54. FILE *mntfp;
  55. -#elif HAVE_FSTAB_H
  56. +#elif defined(HAVE_FSTAB_H)
  57. struct fstab *fstab1;
  58. -#elif HAVE_STATFS
  59. +#elif defined(HAVE_STATFS)
  60. struct statfs statf;
  61. #endif
  62. #if defined(HAVE_GETMNTENT) && !defined(HAVE_SETMNTENT)
  63. @@ -397,8 +397,8 @@
  64. * string declared above and at the end of the routine return it
  65. * to the caller
  66. */
  67. -#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
  68. -#if HAVE_GETMNTENT
  69. +#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
  70. +#if defined(HAVE_GETMNTENT)
  71. #if HAVE_SETMNTENT
  72. mntfp = setmntent(ETC_MNTTAB, "r");
  73. while (NULL != (mntent = getmntent(mntfp))) {
  74. @@ -425,7 +425,7 @@
  75. */
  76. }
  77. #endif /* HAVE_SETMNTENT */
  78. -#elif HAVE_FSTAB_H
  79. +#elif defined(HAVE_FSTAB_H)
  80. setfsent(); /* open /etc/fstab */
  81. while((fstab1 = getfsent()) != NULL) {
  82. add_device(fstab1->fs_file, fstab1->fs_spec, -1, minpercent, 0);
  83. @@ -437,7 +437,7 @@
  84. * dummy clause for else below
  85. */
  86. }
  87. -#elif HAVE_STATFS
  88. +#elif defined(HAVE_STATFS)
  89. /*
  90. * since there is no way to get all the mounted systems with just
  91. * statfs we default to the root partition "/"
  92. @@ -461,24 +461,24 @@
  93. }
  94. #else
  95. config_perror("'disk' checks not supported on this architecture.");
  96. -#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
  97. +#endif /* defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS) */
  98. }
  99. static u_char *
  100. find_device(char *path)
  101. {
  102. -#if HAVE_GETMNTENT
  103. +#if defined(HAVE_GETMNTENT)
  104. #if HAVE_SYS_MNTTAB_H
  105. struct mnttab mnttab;
  106. #else
  107. struct mntent *mntent;
  108. #endif
  109. FILE *mntfp;
  110. -#elif HAVE_FSTAB_H
  111. +#elif defined(HAVE_FSTAB_H)
  112. struct fstab *fstab;
  113. struct stat stat1;
  114. -#elif HAVE_STATFS
  115. +#elif defined(HAVE_STATFS)
  116. struct statfs statf;
  117. #endif
  118. char tmpbuf[1024];
  119. @@ -494,8 +494,8 @@
  120. * string declared above and at the end of the routine return it
  121. * to the caller
  122. */
  123. -#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
  124. -#if HAVE_GETMNTENT
  125. +#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
  126. +#if defined(HAVE_GETMNTENT)
  127. #if HAVE_SETMNTENT
  128. mntfp = setmntent(ETC_MNTTAB, "r");
  129. while (NULL != (mntent = getmntent(mntfp)))
  130. @@ -526,14 +526,14 @@
  131. sizeof(device));
  132. }
  133. #endif /* HAVE_SETMNTENT */
  134. -#elif HAVE_FSTAB_H
  135. +#elif defined(HAVE_FSTAB_H)
  136. stat(path, &stat1);
  137. setfsent();
  138. if ((fstab = getfsfile(path))) {
  139. copy_nword(fstab->fs_spec, device,
  140. sizeof(device));
  141. }
  142. -#elif HAVE_STATFS
  143. +#elif defined(HAVE_STATFS)
  144. if (statfs(path, &statf) == 0) {
  145. copy_word(statf.f_mntfromname, device);
  146. DEBUGMSGTL(("ucd-snmp/disk", "Disk: %s\n",
  147. @@ -545,12 +545,12 @@
  148. path);
  149. config_pwarn(tmpbuf);
  150. }
  151. -#if HAVE_FSTAB_H
  152. +#if defined(HAVE_FSTAB_H)
  153. endfsent();
  154. #endif
  155. #else
  156. config_perror("'disk' checks not supported on this architecture.");
  157. -#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
  158. +#endif /* defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS) */
  159. return device;
  160. }
  161. @@ -597,7 +597,7 @@
  162. struct statvfs vfs;
  163. #endif
  164. #else
  165. -#if HAVE_FSTAB_H
  166. +#if defined(HAVE_FSTAB_H)
  167. int file;
  168. union {
  169. struct fs iu_fs;
  170. @@ -715,7 +715,7 @@
  171. return ((u_char *) (errmsg));
  172. }
  173. #else
  174. -#if HAVE_FSTAB_H
  175. +#if defined(HAVE_FSTAB_H)
  176. /*
  177. * read the disk information
  178. */