From c4645e4de4ca0b597da70e871f2422160c838fd4 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 30 Oct 2013 11:57:31 +0100 Subject: [PATCH] PING(8): Use BSD program lock --- freebsd/sbin/ping/ping.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/freebsd/sbin/ping/ping.c b/freebsd/sbin/ping/ping.c index 4b7f96ad..ae144698 100644 --- a/freebsd/sbin/ping/ping.c +++ b/freebsd/sbin/ping/ping.c @@ -44,6 +44,8 @@ static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; #ifdef __rtems__ #define __need_getopt_newlib #include +#include +#include #endif /* __rtems__ */ #include __FBSDID("$FreeBSD$"); @@ -220,13 +222,14 @@ static void tvsub(struct timeval *, struct timeval *); static void usage(void) __dead2; #ifdef __rtems__ -#include -#include - static int main(int argc, char **argv); int rtems_bsd_command_ping(int argc, char *argv[]) { + int exit_code; + + rtems_bsd_program_lock(); + BBELL = '\a'; BSPACE = '\b'; DOT = '.'; @@ -243,7 +246,11 @@ int rtems_bsd_command_ping(int argc, char *argv[]) tsum = 0.0; tsumsq = 0.0; - return rtems_bsd_program_call_main("ping", main, argc, argv); + exit_code = rtems_bsd_program_call_main("ping", main, argc, argv); + + rtems_bsd_program_unlock(); + + return exit_code; } #endif /* __rtems__ */ int