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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
--- tagutils/tagutils.c 2010-12-13 01:41:52.000000000 -0500
+++ tagutils/tagutils.c 2010-12-13 17:28:29.000000000 -0500
@@ -36,6 +36,7 @@
#include <vorbis/codec.h>
#include <FLAC/metadata.h>
+#include <libgen.h>
-#include "../config.h"
+#include "config.h"
#ifdef HAVE_ICONV_H
#include <iconv.h>
--- image_utils.c 2011-05-03 18:07:47.000000000 -0400
+++ image_utils.c 2011-08-24 01:11:13.000000000 -0400
@@ -34,5 +34,5 @@
#include <setjmp.h>
#include <jpeglib.h>
-#include <endian.h>
+#include <sys/endian.h>
#include "upnpreplyparse.h"
--- upnpdescgen.c 2011-05-03 18:07:47.000000000 -0400
+++ upnpdescgen.c 2011-08-24 01:32:48.000000000 -0400
@@ -585,5 +585,5 @@
const struct XMLElt * p)
{
- u_int16_t i, j, k;
+ uint16_t i, j, k;
int top;
const char * eltname, *s;
--- upnpglobalvars.c 2011-05-26 19:10:54.000000000 -0400
+++ upnpglobalvars.c 2011-08-24 01:33:57.000000000 -0400
@@ -49,5 +49,5 @@
#include <sys/types.h>
#include <netinet/in.h>
-#include <linux/limits.h>
+#include <limits.h>
#include "config.h"
--- tagutils/misc.c 2010-11-11 18:48:14.000000000 -0500
+++ tagutils/misc.c 2011-08-24 01:36:58.000000000 -0400
@@ -22,5 +22,5 @@
#include <stdio.h>
#include <string.h>
-#include <endian.h>
+#include <sys/endian.h>
#include "misc.h"
--- uuid.c 2011-05-26 19:04:33.000000000 -0400
+++ uuid.c 2011-08-24 01:56:11.000000000 -0400
@@ -31,4 +31,5 @@
#include <sys/syscall.h>
#include <string.h>
+#include <sys/socket.h>
#include <net/if.h>
#include <sys/ioctl.h>
@@ -47,13 +48,4 @@
static int clock_seq_initialized;
-unsigned long long
-monotonic_us(void)
-{
- struct timespec ts;
-
- syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts);
- return ts.tv_sec * 1000000ULL + ts.tv_nsec / 1000;
-}
-
-int
+static int
read_bootid_node(unsigned char *buf, size_t size)
@@ -82,26 +74,13 @@
read_random_bytes(unsigned char *buf, size_t size)
{
- int i;
- pid_t pid;
+ long r;
+ srandomdev();
- i = open("/dev/urandom", O_RDONLY);
- if(i >= 0)
- {
- read(i, buf, size);
- close(i);
- }
- /* Paranoia. /dev/urandom may be missing.
- * rand() is guaranteed to generate at least [0, 2^15) range,
- * but lowest bits in some libc are not so "random". */
- srand(monotonic_us());
- pid = getpid();
- while(1)
- {
- for(i = 0; i < size; i++)
- buf[i] ^= rand() >> 5;
- if(pid == 0)
- break;
- srand(pid);
- pid = 0;
+ while ((ssize_t)size > 0) {
+ r = random();
+ memcpy(buf, &r,
+ size > sizeof(r) ? sizeof(r) : size);
+ buf += sizeof(r);
+ size -= sizeof(r);
}
}
@@ -163,5 +142,5 @@
* Gregorian reform to the Christian calendar).
*/
- syscall(__NR_clock_gettime, CLOCK_REALTIME, &ts);
+ clock_gettime(CLOCK_REALTIME, &ts);
time_all = ((u_int64_t)ts.tv_sec) * (NSEC_PER_SEC / 100);
time_all += ts.tv_nsec / 100;
--- tagutils/tagutils-asf.h 2010-11-11 18:48:14.000000000 -0500
+++ tagutils/tagutils-asf.h 2011-08-24 01:57:26.000000000 -0400
@@ -24,5 +24,5 @@
#define __PACKED__ __attribute__((packed))
-#include <endian.h>
+#include <sys/endian.h>
typedef struct _GUID {
--- utils.c 2011-07-18 14:13:25.000000000 -0400
+++ utils.c 2011-09-21 00:58:47.000000000 -0400
@@ -207,11 +207,15 @@
}
- if (mkdir(path, mode) < 0) {
+ if (!(path[0] == '/' && s == path + 1) /* skip "/" */
+ && mkdir(path, mode) < 0) {
+ int e = errno;
/* If we failed for any other reason than the directory
* already exists, output a diagnostic and return -1.*/
if (errno != EEXIST || (stat(path, &st) < 0 || !S_ISDIR(st.st_mode))) {
- DPRINTF(E_WARN, L_GENERAL, "make_dir: cannot create directory '%s'\n", path);
if (c)
*s = c;
+ DPRINTF(E_WARN, L_GENERAL, "make_dir: cannot "
+ "create directory '%.*s' (to create %s): "
+ "%s\n", s - path, path, path, strerror(e));
return -1;
}
|