forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logrotate-3.9.1-noasprintf.patch
55 lines (52 loc) · 1.23 KB
/
logrotate-3.9.1-noasprintf.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
diff -Nuar a/config.c b/config.c
--- a/config.c 2015-06-28 13:56:49.599999885 +0200
+++ b/config.c 2015-06-28 13:59:34.799999880 +0200
@@ -49,39 +49,6 @@
#include "asprintf.c"
#endif
-#if !defined(asprintf) && !defined(_FORTIFY_SOURCE)
-#include <stdarg.h>
-
-int asprintf(char **string_ptr, const char *format, ...)
-{
- va_list arg;
- char *str;
- int size;
- int rv;
-
- va_start(arg, format);
- size = vsnprintf(NULL, 0, format, arg);
- size++;
- va_start(arg, format);
- str = malloc(size);
- if (str == NULL) {
- va_end(arg);
- /*
- * Strictly speaking, GNU asprintf doesn't do this,
- * but the caller isn't checking the return value.
- */
- fprintf(stderr, "failed to allocate memory\\n");
- exit(1);
- }
- rv = vsnprintf(str, size, format, arg);
- va_end(arg);
-
- *string_ptr = str;
- return (rv);
-}
-
-#endif
-
#if !defined(strndup)
char *strndup(const char *s, size_t n)
{
diff -Nuar a/logrotate.h b/logrotate.h
--- a/logrotate.h 2015-04-03 09:39:35.000000000 +0200
+++ b/logrotate.h 2015-06-28 13:59:47.429999880 +0200
@@ -80,8 +80,5 @@
extern int debug;
int readAllConfigPaths(const char **paths);
-#if !defined(asprintf) && !defined(_FORTIFY_SOURCE)
-int asprintf(char **string_ptr, const char *format, ...);
-#endif
#endif