|
a/upmpd/upmpdutils.cxx |
|
b/upmpd/upmpdutils.cxx |
|
... |
|
... |
67 |
// Also couldn't find an easy way to disable the gnu version without
|
67 |
// Also couldn't find an easy way to disable the gnu version without
|
68 |
// changing the cxxflags globally, so forget it. Recent gnu lib versions
|
68 |
// changing the cxxflags globally, so forget it. Recent gnu lib versions
|
69 |
// normally default to the posix version.
|
69 |
// normally default to the posix version.
|
70 |
// At worse we get no message at all here.
|
70 |
// At worse we get no message at all here.
|
71 |
errbuf[0] = 0;
|
71 |
errbuf[0] = 0;
|
72 |
strerror_r(_errno, errbuf, ERRBUFSZ);
|
72 |
(void)strerror_r(_errno, errbuf, ERRBUFSZ);
|
73 |
reason->append(errbuf);
|
73 |
reason->append(errbuf);
|
74 |
#endif
|
74 |
#endif
|
75 |
}
|
75 |
}
|
76 |
|
76 |
|
77 |
bool file_to_string(const string &fn, string &data, string *reason)
|
77 |
bool file_to_string(const string &fn, string &data, string *reason)
|
|
... |
|
... |
88 |
}
|
88 |
}
|
89 |
|
89 |
|
90 |
data.reserve(st.st_size+1);
|
90 |
data.reserve(st.st_size+1);
|
91 |
|
91 |
|
92 |
char buf[RDBUFSZ];
|
92 |
char buf[RDBUFSZ];
|
93 |
size_t totread = 0;
|
|
|
94 |
for (;;) {
|
93 |
for (;;) {
|
95 |
int n = read(fd, buf, RDBUFSZ);
|
94 |
int n = read(fd, buf, RDBUFSZ);
|
96 |
if (n < 0) {
|
95 |
if (n < 0) {
|
97 |
catstrerror(reason, "read", errno);
|
96 |
catstrerror(reason, "read", errno);
|
98 |
goto out;
|
97 |
goto out;
|