summaryrefslogtreecommitdiffstats
path: root/web/attachments/136655-nagiosplug-common_h-sanity.diff
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/136655-nagiosplug-common_h-sanity.diff')
-rw-r--r--web/attachments/136655-nagiosplug-common_h-sanity.diff116
1 files changed, 116 insertions, 0 deletions
diff --git a/web/attachments/136655-nagiosplug-common_h-sanity.diff b/web/attachments/136655-nagiosplug-common_h-sanity.diff
new file mode 100644
index 0000000..187f298
--- /dev/null
+++ b/web/attachments/136655-nagiosplug-common_h-sanity.diff
@@ -0,0 +1,116 @@
1diff -urN ../orig.nplg/plugins/common.h ./plugins/common.h
2--- ../orig.nplg/plugins/common.h 2004-12-10 11:42:00.000000000 +0100
3+++ ./plugins/common.h 2005-05-31 14:34:48.000000000 +0200
4@@ -32,7 +32,17 @@
5 *
6 *****************************************************************************/
7
8-#include "config.h"
9+#ifndef NAGIOSPLUG_COMMON_H
10+#define NAGIOSPLUG_COMMON_H
11+
12+/* For non-GNU compilers to ignore __attribute__
13+ * This must be here so that imported GNU headers can be used with non-gnu
14+ * compilers and so we can safely (and properly) put prototypes here. */
15+#ifndef __GNUC__
16+# define __attribute__(x) /* do nothing */
17+#endif
18+
19+# include "config.h"
20
21 #ifdef HAVE_FEATURES_H
22 #include <features.h>
23@@ -131,19 +141,25 @@
24 #endif
25
26 #ifndef HAVE_ASPRINTF
27-int asprintf(char **strp, const char *fmt, ...);
28+int asprintf(char **strp, const char *fmt, ...)
29+ __attribute__((__format__(__printf__, 2, 3)));
30 #endif
31
32+/*
33 #ifndef HAVE_VASPRINTF
34-/* int vasprintf(char **strp, const char *fmt, va_list ap); */
35+int vasprintf(char **strp, const char *fmt, va_list ap)
36+ __attribute__((__format__(__printf__, 2, 0)));
37 #endif
38+*/
39
40 #ifndef HAVE_SNPRINTF
41-int snprintf(char *str, size_t size, const char *format, ...);
42+int snprintf(char *str, size_t size, const char *format, ...)
43+ __attribute__((__format__(__printf__, 3, 4)));
44 #endif
45
46 #ifndef HAVE_VSNPRINTF
47-int vsnprintf(char *str, size_t size, const char *format, va_list ap);
48+int vsnprintf(char *str, size_t size, const char *format, va_list ap)
49+ __attribute__((__format__(__printf__, 3, 0)));
50 #endif
51
52 /*
53@@ -152,32 +168,31 @@
54 *
55 */
56
57-enum {
58- OK = 0,
59- ERROR = -1
60-};
61+/* These should be macros so they never have to be fetched
62+ * from a different data-segment than the code evaluating it (which is
63+ * bizarrely expensive on some weird architectures). It also makes it
64+ * easier to develop and implement additional API's without mucking about
65+ * with the "official" code (#ifdef STATE_CRITICAL etc).
66+ */
67+#define OK 0
68+#define ERROR -1
69
70 /* AIX seems to have this defined somewhere else */
71 #ifndef FALSE
72-enum {
73- FALSE,
74- TRUE
75-};
76-#endif
77-
78-enum {
79- STATE_OK,
80- STATE_WARNING,
81- STATE_CRITICAL,
82- STATE_UNKNOWN,
83- STATE_DEPENDENT
84-};
85-
86-enum {
87- DEFAULT_SOCKET_TIMEOUT = 10, /* timeout after 10 seconds */
88- MAX_INPUT_BUFFER = 1024, /* max size of most buffers we use */
89- MAX_HOST_ADDRESS_LENGTH = 256 /* max size of a host address */
90-};
91+# define FALSE 0
92+# define TRUE 1
93+#endif
94+
95+#define STATE_OK 0
96+#define STATE_WARNING 1
97+#define STATE_CRITICAL 2
98+#define STATE_UNKNOWN 3
99+#define STATE_DEPENDENT 4
100+#define STATE_OOB 5 /* status out of bounds. Must be last */
101+
102+#define DEFAULT_SOCKET_TIMEOUT 10 /* timeout after 10 seconds */
103+#define MAX_INPUT_BUFFER 1024 /* max size of most buffers we use */
104+#define MAX_HOST_ADDRESS_LENGTH 256 /* max size of a host address */
105
106 /*
107 *
108@@ -187,7 +202,4 @@
109 #include "gettext.h"
110 #define _(String) gettext (String)
111
112-/* For non-GNU compilers to ignore __attribute__ */
113-#ifndef __GNUC__
114-# define __attribute__(x) /* do nothing */
115-#endif
116+#endif /* NAGIOSPLUG_COMMON_H */