projects
/
oweals
/
tinc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dea722c
)
Add a newline to a configuration file if it is missing.
author
Guus Sliepen
<guus@tinc-vpn.org>
Sat, 21 Jul 2012 13:02:44 +0000
(15:02 +0200)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Sat, 21 Jul 2012 13:02:44 +0000
(15:02 +0200)
src/tincctl.c
patch
|
blob
|
history
diff --git
a/src/tincctl.c
b/src/tincctl.c
index b944e5c451c8753dd6b28660c8f111e6cfdc950d..a3688ecaebc420bd4dde901d1df4f21984cc03ef 100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-1234,6
+1234,14
@@
static int cmd_config(int argc, char *argv[]) {
fprintf(stderr, "Error writing to temporary file %s: %s\n", tmpfile, strerror(errno));
return 1;
}
+
+ // Add newline if it is missing...
+ if(*buf1 && buf1[strlen(buf1) - 1] != '\n') {
+ if(fputc('\n', tf) < 0) {
+ fprintf(stderr, "Error writing to temporary file %s: %s\n", tmpfile, strerror(errno));
+ return 1;
+ }
+ }
}
// Make sure we read everything...