projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tincctl restart should work even if no tincd is running.
[tinc]
/
src
/
utils.c
diff --git
a/src/utils.c
b/src/utils.c
index
022ac25
..
e750450
100644
(file)
--- a/
src/utils.c
+++ b/
src/utils.c
@@
-66,7
+66,7
@@
int bin2hex(const char *src, char *dst, int length) {
int b64decode(const char *src, char *dst, int length) {
int i;
uint32_t triplet = 0;
int b64decode(const char *src, char *dst, int length) {
int i;
uint32_t triplet = 0;
- unsigned char *udst = dst;
+ unsigned char *udst =
(unsigned char *)
dst;
for(i = 0; i < length / 3 * 4 && src[i]; i++) {
triplet |= charb64decode(src[i]) << (6 * (i & 3));
for(i = 0; i < length / 3 * 4 && src[i]; i++) {
triplet |= charb64decode(src[i]) << (6 * (i & 3));
@@
-92,7
+92,7
@@
int b64decode(const char *src, char *dst, int length) {
int b64encode(const char *src, char *dst, int length) {
uint32_t triplet;
int b64encode(const char *src, char *dst, int length) {
uint32_t triplet;
- const unsigned char *usrc = src;
+ const unsigned char *usrc =
(unsigned char *)
src;
int si = length / 3 * 3;
int di = length / 3 * 4;
int si = length / 3 * 3;
int di = length / 3 * 4;
@@
-137,15
+137,17
@@
int b64encode(const char *src, char *dst, int length) {
#endif
const char *winerror(int err) {
#endif
const char *winerror(int err) {
- static char buf[1024], *newline;
+ static char buf[1024], *ptr;
+
+ ptr = buf + sprintf(buf, "(%d) ", err);
if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buf, sizeof(
buf), NULL)) {
+ NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
ptr, sizeof(buf) - (ptr -
buf), NULL)) {
strncpy(buf, "(unable to format errormessage)", sizeof(buf));
};
strncpy(buf, "(unable to format errormessage)", sizeof(buf));
};
- if((
newline
= strchr(buf, '\r')))
- *
newline
= '\0';
+ if((
ptr
= strchr(buf, '\r')))
+ *
ptr
= '\0';
return buf;
}
return buf;
}