diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2016-07-16 16:11:07 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2016-07-16 16:11:33 -0400 |
commit | 3cf52771df0c57c1f6096f3600d29accb6b41d37 (patch) | |
tree | cd1da94b456b58f1d4980892ab14067e723d4357 /ntpshmmon.c | |
parent | 9215ff94d51f754f279866c2943144c469d90e69 (diff) | |
download | gpsd-3cf52771df0c57c1f6096f3600d29accb6b41d37.tar.gz |
Try to prevent ntpshmmon from writing a short record on interrupt.
Diffstat (limited to 'ntpshmmon.c')
-rw-r--r-- | ntpshmmon.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ntpshmmon.c b/ntpshmmon.c index b68e2553..ec51d277 100644 --- a/ntpshmmon.c +++ b/ntpshmmon.c @@ -84,6 +84,13 @@ int main(int argc, char **argv) exit(EXIT_SUCCESS); } + /* + * We want line buffering even if stdout is going to a file. This + * is a (possibly futile) attempt to avoid writing an incomplete + * line on interrupt. + */ + setvbuf(stdout, NULL, _IOLBF, 0); + (void)printf("ntpshmmon version 1\n"); (void)printf("# Name Seen@ Clock Real L Prec\n"); |