From a8421e81078b91ae97ada3be352416eae26a9c7b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 10 Sep 2006 14:19:38 +0000 Subject: r18343: fixed setlinebuf() prototype, added test for it, and use it in two places to avoid a #ifdef (This used to be commit 095b8057740a4bb207e24e4c63a2dcb53521a72f) --- source4/lib/replace/replace.c | 4 ++-- source4/lib/replace/replace.h | 2 +- source4/lib/replace/test/testsuite.c | 3 ++- source4/torture/smbtorture.c | 4 +--- source4/utils/net/net.c | 4 +--- 5 files changed, 7 insertions(+), 10 deletions(-) (limited to 'source4') diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index 048ea3a998..aa3e8717c2 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -338,9 +338,9 @@ char *rep_inet_ntoa(struct in_addr ip) #endif #ifndef HAVE_SETLINEBUF -int rep_setlinebuf(FILE *stream) +void rep_setlinebuf(FILE *stream) { - return setvbuf(stream, (char *)NULL, _IOLBF, 0); + setvbuf(stream, (char *)NULL, _IOLBF, 0); } #endif /* HAVE_SETLINEBUF */ diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h index ee86a81b5d..7664c51a5d 100644 --- a/source4/lib/replace/replace.h +++ b/source4/lib/replace/replace.h @@ -140,7 +140,7 @@ int rep_setegid(gid_t); #ifndef HAVE_SETLINEBUF #define setlinebuf rep_setlinebuf -int rep_setlinebuf(FILE *); +void rep_setlinebuf(FILE *); #endif #ifndef HAVE_STRCASESTR diff --git a/source4/lib/replace/test/testsuite.c b/source4/lib/replace/test/testsuite.c index 33270d9a4a..89d2ae6a88 100644 --- a/source4/lib/replace/test/testsuite.c +++ b/source4/lib/replace/test/testsuite.c @@ -146,7 +146,8 @@ static int test_strdup(void) static int test_setlinebuf(void) { - /* FIXME */ + printf("testing setlinebuf\n"); + setlinebuf(stdout); return true; } diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index b924b37c23..3e834970a7 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -413,9 +413,7 @@ const static struct torture_ui_ops quiet_ui_ops = { { NULL } }; -#ifdef HAVE_SETBUFFER - setbuffer(stdout, NULL, 0); -#endif + setlinebuf(stdout); /* we are never interested in SIGPIPE */ BlockSignals(True,SIGPIPE); diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index 70c1de922d..7e885acfe8 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -151,9 +151,7 @@ static int binary_net(int argc, const char **argv) { NULL } }; -#ifdef HAVE_SETBUFFER - setbuffer(stdout, NULL, 0); -#endif + setlinebuf(stdout); pc = poptGetContext("net", argc, (const char **) argv, long_options, POPT_CONTEXT_KEEP_FIRST); -- cgit